- 区间
- 2009-05-13 20:31:00 @
我为什么错了
var n,i,j,a,b,c,max:longint;
dis:array[0..50001]of longint;
bb:array[0..250000,1..3]of longint;
f:boolean;
begin
readln(n);
max:=0;
for i:=1 to n do begin
readln(bb,bb,bb);
dec(bb);
if bb>max then max:=bb;
end;
for i:=1 to max do begin
bb:=i-1;bb:=i;bb:=0;
bb:=i;bb:=i-1;bb:=-1;
end;
fillchar(dis,sizeof(dis),0);
for i:=1 to max-1 do begin
f:=true;
for j:=1 to n+n+n do
if (dis[bb[j,1]]+bb[j,3]>dis[bb[j,2]]) then begin
dis[bb[j,2]]:=dis[bb[j,1]]+bb[j,3];
f:=false;
end;
if f then break;
end;
a:=0;
for i:=1 to max do
if dis[i]>a then a:=dis[i];
writeln(a);
end.
2 条评论
-
fanzhirui LV 7 @ 2013-11-16 18:04:36
可能加边错了吧
-
2010-04-10 11:11:23@
无题
因为你笨啊
- 1