10.27 exercises Thomas train

10.27 exercises Thomas train

KONO 题面 哒!

Description of the problem
with the total loss sound of the theme song sounded Thomas, Thomas the train began racing it! Thomas town where can be seen as an undirected graph, each edge has a length m of n points constituting the edges. There are two built FIG total loss sound theme Thomas A and B Thomas. A along a shortest path from point A to point B, point B along the shortest path from B to A points. A and B exist between the two Thomas unpredictable quantum entanglement , they will meet the road Biao Song.
I asked how many kinds of moves, town residents will not be total loss of sound quality noise pollution. It refers to meet with meet at some point or the edge of a strip. The answer may be large, mod 10 ^ 9 + 7 and then output.

Input format
of the first row, two integers n, m the second row, two integers A, B next m lines of three integers x, y, z, z indicates there is a length between the point x and point y side.
Output formats
an integer representing the number of programs.

Sample Input 1
. 4. 4
. 1. 3
1 2. 1
2. 3. 1
. 3. 1. 4
. 4. 1. 1
Sample Output 1
2

Sample input 2
. 8 13 is
. 4 2
. 7. 9. 3
. 6 2. 3
. 1. 4. 6
. 7. 6. 9
. 3. 8. 9
. 1 2 2
2 12 is. 8
. 8. 6. 9
2. 5. 5
. 4 2 18 is
. 5. 3. 7
. 5. 1 515 371 567
. 4. 8. 6
Sample Input 2
6

Data range
to 100% of the data, 1 ≤ n ≤100000 1 ≤ mFIG communication, and no multiple edges


I have been struggling A, C. This is the road only to find flood problem) after reading (actually listened)



KONO bill 码哒!

Guess you like

Origin www.cnblogs.com/cooper233/p/11754490.html