Pagini recente » Cod sursa (job #743942) | Rating Zaharie Oana (oana_9A) | Istoria paginii runda/eusebiu_oji_2009_cls9/clasament | Cod sursa (job #2513582) | Cod sursa (job #2395987)
type tabel=array[1..100,1..100] of longint;
var n,i,j,k,a,b:longint;
t:tabel;
begin
assign(input,'royfloyd.in');
assign(output,'royfloyd.out');
reset(input);
rewrite(output);
read(n);
for i:=1 to n do
for j:=1 to n do read(t[i,j]);
for k:=1 to n do
for i:=1 to n do
for j:=1 to n do
if t[i,j]>t[i,k]+t[k,j] then
t[i,j]:=t[i,k]+t[k,j];
for i:=1 to n do begin
for j:=1 to n do write(t[i,j],' ');
writeln end;
close(input);
close(output);
end.