задача 1336

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n, m = map(int, input().split())
s, e = map(int, input().split())
a = [[-1.0]*n for i in range(n)]
for i in range(m):
b, c, l = map(int, input().split())
a[b-1][c-1] =1-l/100
a[c-1][b-1] =1-l/100
for k in range(n):
for i in range(n):
for j in range(n):
if i!=j:
a[i][j] = max(a[i][j], a[i][k]*a[k][j])
print(1-a[s-1][e-1])