Difficulity：
1
| Test Data Sets: 5 (Hidden) | Judging:
Traditional Judge

Accepted : 141 Times | Submit :350 Times | Clicks : 3022

Accepted ： 101 Users | Submit : 113 Users | Accepted rate : 89%

Time Limit ：1000 ms | Memory Limit : 64000 KBytes

Update : 2015-06-11 21:56

Accepted : 141 Times | Submit :350 Times | Clicks : 3022

Accepted ： 101 Users | Submit : 113 Users | Accepted rate : 89%

Time Limit ：1000 ms | Memory Limit : 64000 KBytes

Update : 2015-06-11 21:56

Mr. G. works as a tourist guide. His current assignment is to take some tourists from one city to another. Some two-way roads connect the cities. For each pair of neighboring cities there is a bus service that runs only between those two cities and uses the road that directly connects them. Each bus service has a limit on the maximum number of passengers it can carry. Mr. G. has a map showing the cities and the roads connecting them. He also has the information regarding each bus service. He understands that it may not always be possible for him to take all the tourists to the destination city in a single trip. For example, consider the following road map of 7 cities. The edges connecting the cities represent the roads and the number written on each edge indicates the passenger limit of the bus service that runs on that road.

Now, if he wants to take 99 tourists from city 1 to city 7, he will require at least 5 trips, since he has to ride the bus with each group, and the route he should take is : 1 - 2 - 4 - 7.

But, Mr. G. finds it difficult to find the best route all by himself so that he may be able to take all the tourists to the destination city in minimum number of trips. So, he seeks your help.

**
Input：**

The input will contain one or more test cases. The first line of each test case will contain two integers: *N* (N<= 100) and *R* representing respectively the number of cities and the number of road segments. Then *R* lines will follow each containing three integers: *C*_{1}, *C** _{2}* and

The input will end with two zeroes for *N* and *R*.

**
Output：**

For each test case in the input first output the scenario number. Then output the minimum number of trips required for this case on a separate line. Print a blank line after the output of each test case.

**
Sample Input：**

若題目沒有特別說明，則應該以多測資的方式讀取，若不知如何讀取請參考 a001 的範例程式。

7 10 1 2 30 1 3 15 1 4 10 2 4 25 2 5 60 3 4 40 3 6 20 4 7 35 5 7 20 6 7 30 1 7 99 0 0

**
Sample Output
：**

Scenario #1 Minimum Number of Trips = 5

**
Hint
：**

**
Author
：**

Rezaul Alam Chowdhury
(Manager: taskmanager)

C |
C++ |
JAVA |
PASCAL |
---|---|---|---|

5207. zelda (0ms, 236KB, 1012B) |
59326. zxkyjimmy (0ms, 710KB, 1633B) |
||

Program running time may be affected by various factors. Check server system environment information here