- 想越狱的小杉
- 2009-10-25 22:50:56 @
var i,j,k,n,a1,a2,a3,max:longint;
f:array[0..2000,0..2000]of longint;
a,b:array[0..2010]of longint;
function bj(x,y:longint):longint;
begin
if x>y then exit(y) else exit(x);
end;
begin
read(n);
repeat
read(a1,a2,a3);
f[a1,a2]:=a3;
until (a1=0)and(a2=0)and(a3=0);
for i:=2 to n do a[i]:=f[1,i];
for i:=2 to n do
begin
max:=0;
for j:=1 to n do if (a[j]>max)and(b[j]1) then begin max:=a[j];k:=j;end;
b[k]:=1;
for j:=1 to n do
begin
if (b[j]1)and(bj(a[j],f[k,j])>a[j]) then a[j]:=bj(a[j],f[k,j]);
end;
end;
for i:=2 to n do writeln(a[i]);
end.
0 条评论
目前还没有评论...