Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- w:array[1..100,1..100] of int64;
- i,j,n,m,k,v1,v2:longint;
- 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]);
- read(v1,v2);
- 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]);
- write(w[v1][v2]);
- end.
Advertisement
Add Comment
Please, Sign In to add comment