记录编号 |
14151 |
评测结果 |
AAAAAAAAAAAA |
题目名称 |
[POI 1998] 公路网 |
最终得分 |
100 |
用户昵称 |
打不死的羊 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.286 s |
提交时间 |
2009-10-27 15:20:05 |
内存使用 |
0.13 MiB |
显示代码纯文本
program sie;
type
fxz1=array[1..200,1..200] of longint;
fxz2=array[1..200,1..200] of boolean;
var
f1,f2:text;
i,j,k,n:longint;
map:fxz1;
ans:fxz2;
begin assign(f1,'sie.in');
assign(f2,'sie.out');
reset(f1);rewrite(f2);
readln(f1,n);
for i:=1 to n do begin for j:=1 to n do begin ans[i,j]:=true;read(f1,map[i,j]);end;
readln(f1);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
for k:=1 to n do
if (map[i,j]=map[i,k]+map[k,j])and(k<>i)and(j<>k)and(i<>j) then ans[i,j]:=false;
for i:=1 to n-1 do
for j:=i+1 to n do
if ans[i,j] then writeln(f2,i,' ',j);
close(f1);close(f2);
end.
program sie;
type
fxz1=array[1..200,1..200] of longint;
fxz2=array[1..200,1..200] of boolean;
var
f1,f2:text;
i,j,k,n:longint;
map:fxz1;
ans:fxz2;
begin assign(f1,'sie.in');
assign(f2,'sie.out');
reset(f1);rewrite(f2);
readln(f1,n);
for i:=1 to n do begin for j:=1 to n do begin ans[i,j]:=true;read(f1,map[i,j]);end;
readln(f1);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
for k:=1 to n do
if (map[i,j]=map[i,k]+map[k,j])and(k<>i)and(j<>k)and(i<>j) then ans[i,j]:=false;
for i:=1 to n-1 do
for j:=i+1 to n do
if ans[i,j] then writeln(f2,i,' ',j);
close(f1);close(f2);
end.