|
|
вернуться в форумI got AC,here is program Послано ufx 3 апр 2003 08:11 just using top-sort program ex; const maxn=100; var b:array[1..maxn] of integer; g:array[1..maxn,1..maxn] of integer; i,j,k,n:integer;
begin fillchar(b,sizeof(b),0); fillchar(g,sizeof(g),0); readln(n); for i:=1 to n do begin read(j); while (j<>0) do begin inc(b[j]); g[j,i]:=1; read(j); end; end;
for i:=1 to n do begin j:=1; while (b[j]<>0) do inc(j); write(j,' '); b[j]:=maxint; for k:=1 to n do if (g[k,j]=1) then dec(b[k]); end; writeln; end. |
|
|