诛仙3魔焚香pk:谁能帮我翻译一下这个问题啊?

来源:百度文库 编辑:高校问答 时间:2024/05/10 05:24:02
Input

The input contains the descriptions of several scenarios in which Trisha tries to escape. Every description starts with a line containing two integers n and k. n is the number of cities through which Trisha's escape may take her, and k is the number of flights she will take. The cities are numbered 1, 2, ..., n, where 1 is Paris, her starting point, and n is Atlanta, her final destination. The numbers will satisfy 2 <= n <= 10 and 1 <= k <= 1000.
Next you are given n(n - 1) flight schedules, one per line, describing the connection between every possible pair of cities. The first n - 1 flight schedules correspond to the flights from city 1 to all other cities (2, 3, ..., n), the next n - 1 lines to those from city 2 to all others (1, 3, 4, ..., n), and so on.

The description of the flight schedule itself starts with an integer d, the length of the period in days, with 1 <= d <= 30. Following this are d non-negative integers, representing the cost of the flight between the two cities on days 1, 2, ..., d. A cost of 0 means that there is no flight between the two cities on that day.

So, for example, the flight schedule ``3 75 0 80'' means that on the first day the flight costs 75, on the second day there is no flight, on the third day it costs 80, and then the cycle repeats: on the fourth day the flight costs 75, there is no flight on the fifth day, etc.

The input is terminated by a scenario having n = k = 0.

Output

For each scenario in the input, first output the number of the scenario, as shown in the sample output. If it is possible for Trisha to travel k days, starting in city 1, each day flying to a different city than the day before, and finally (after k days) arriving in city n, then print ``The best flight costs x.'', where x is the least amount that the k flights can cost.

If it is not possible to travel in such a way, print ``No flight possible.''.

Print a blank line after each scenario.

Sample Input

3 6
2 130 150
3 75 0 80
7 120 110 0 100 110 120 0

Sample Output

Scenario #1
The best flight costs 460.

Scenario #2
No flight possible.

输入

输入在哪 Trisha 试着包含一些情节的描述逃脱。 和包含二整数 n 和 k 的一个线的每描述开始。 n 是城市的数目完成的 Trisha 的逃亡可能带她哪一个,而且 k 是她将会拿的飞行的数目。 城市是 1,2 号,.。。, n, 哪里 1 是巴黎,她的出发点和 n 是亚特兰大,她的最后目的地。 数目将会使 2<= n<=10 和 1<= k 满意 <=1000.
然后你有 n(n- 1) 飞行排程, 一每一线, 描述城市的每一可能双之间的连结。 第一 n- 一次时间表班机符合从城市 1 到所有的其他城市的飞行 (2,3,.。。, n), 下 n- 1个行对那些从城市 2 到全部其它 (1,3,4,.。。, n), 等等。

飞行的描述排程它本身和整数 d 的开始, 周期的长度在数天中, 藉由 1<= d<=30. 跟随这是 d 非否定的整数, 在数天 1,2 在二个城市之间表现飞行的费用,.。。, d。 0 的费用在二个城市之间意谓没有飞行在之上日子。

因此, 举例来说, 时间表班机375080'' 意谓在第一天飞行值 75,在第二天没有飞行, 在它值 80 的第三天, 然后周重复: 在第四天,飞行值 75, 在第五天, 等等。没有飞行

输入被有 n= k=0 的一个情节结束。

输出

对于输入的每个情节, 第一个输出情节的数目, 如样本输出所示。 如果 Trisha 每天旅行 k 是可能的, 在城市 1 中开始, 每天对一个不同的城市飞超过在天以前, 而且最后 (在 k 数天之后) 抵达城市 n, 那么打印最好的飞行花费 x。'', 哪里 x 是最少的数量 k 飞行能花费。

如果在如此的一个方法中旅行是不可能的, 打印没有飞行可能的。''.

打印每个情节后的一个空行。

样本输入

36
2130150
375080
712011001001101200

抽取样品输出

情节 #1
最好的飞行值 460 。

情节 #2
没有飞行可能的。

楼主是在做哪个学校的acm?