uva 10099 - The Tourist Guide翻译

The Tourist Guide
旅游指南
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.
Mr. G. 是个导游。他现在的任务是带一些游客从一个城市到另一个城市。一些双向道城市
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.
每个公交服务规定了自己最大旅客数目。 G.有一个地图显示城市和连接他们的道路
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.
例如,考虑到以下7个城市道路地图。边代表连接城市的道路,每条边上的数字,表示公交服务在在这条路上运输的游客限制
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.
现在,如果他想带99个旅客从城市1到7,他将需要至少5次出行(他必须陪同每一群游客),路线是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.
但是,Mr. G.发现最好路线可能能带所有游客去目标城市最小数字出行是困难的,所以,他寻求你的帮助
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.
输入包含若干组数据。每组第一行有两个整数:N(N<=100) R分别代表城市数量和道路数量
Then R lines will follow each containing three integers: C1, C2 and P. C1 and C2 are the city numbers and P (P> 1) is the limit on the maximum number of passengers to be carried by the bus service between the two cities.
接下来的R行有3个整数(C1,C2,P),C1 C2是城市编号 ,P(P>1)该道路上公交车的最大载客量
City numbers are positive integers ranging from 1 to N. The (R + 1)-th line will contain three integers: S, D and T representing respectively the starting city, the destination city and the number of tourists to be guided.
城市编号为1-N的连续整数。第R+1行包含3个整数:S D T代表出发城市 目的城市 游客的数目
The input will end with two zeroes for N and R.
N=R=0时输入结束。
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.
对于每组输入数据,按照样例输出一行数字编号,接下来输出单独一行 最小往还次数 。
每组数据输出后打印一个空行

你可能感兴趣的:(uva 10099 - The Tourist Guide翻译)