Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var w:array[1..100,1..100] of longint;
- i,j,n,k:longint;
- negative_cycle:boolean;
- function min(a,b:longint):longint;
- begin
- if a < b then min:=a else min:=b;
- end;
- Begin
- read(n);
- for i:=1 to n do
- for j:=1 to n do
- read(w[i][j]);
- for k:=1 to n do
- for i:=1 to n do
- for j:=1 to n do
- w[i][j]:=min(w[i][j],w[i][k]+w[k][j]);
- for i:=1 to n do if w[i][i] < 0 then negative_cycle:=true;
- end.
Advertisement
Add Comment
Please, Sign In to add comment