задача 96

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n = int(input())
matr = [list(map(int, input().split())) for i in range(n)]
for k in range(n): #алгоритм Флойда
for i in range(n):
for j in range(n):
if matr[i][j] > matr[i][k] + matr[k][j]:
matr[i][j] = matr[i][k] + matr[k][j]
print(max([max(string) for string in matr]))