UVa10816 - Travel in Desert(上下边界的问题真的气到我了,所以来一发翻译)

译文:

有一群喜欢在沙漠里旅行的冒险家。众所周知,在沙漠里旅行是很危险的。因此他们每次都要仔细计划他们的行程。在他们做出最后决定之前,需要考虑众多因素。
最重要的因素之一是天气。在极高的温度下旅行是很危险的。他们总是尽量避免去最热的地方。然而,有时这是不可避免的,因为ta可能是到达目的地的唯一途径。为了决定去哪里,他们会选择一个最高温度最低的路线。如果不止一条路线符合此标准,他们将选择最短的路线。
沙漠中有几个绿洲可以休息。这意味着他们在到达目的地之前,行程一定是从一个绿洲到另一个绿洲。他们已经知道了绿洲之间路径的长度和温度。你需要编写一个程序,为他们规划路线。

输入
输入包含多个测试点。你的程序必须处理所有测试点。
第一行包含两个整数N和E(1≤N≤100,1≤E≤10000)N代表绿洲的数量,E代表它们之间路径的数量。下一行包含两个不同的整数S和T(1≤S,T≤N)分别代表的出发点和目的地。下面的E行是收集到的信息。每行包含2个整数X,Y和2实数R,D(1≤X,Y≤N,20≤R≤50,0 < D≤40)。表示X,Y之间有一条路径,长度为D km,最高温度为R°C。每一个实数都保留一位小数点。在两个绿洲之间可能有多条路径。

输出
每个测试点输出两行。第一行应该给出你找到的路线,第二行应该包含它的长度和经过的最高温度。

样例输入
6 9
1 6
1 2 37.1 10.2
2 3 40.5 20.7
3 4 42.8 19.0
3 1 38.3 15.8
4 5 39.7 11.1
6 3 36.0 22.5
5 6 43.9 10.2
2 6 44.2 15.2
4 6 34.2 17.4

样例输出
1 3 6
38.3 - 38.3


原文:

There is a group of adventurers who like to travel in the desert. Everyone knows travelling in desert can be very dangerous. That’s why they plan their trip carefully every time. There are a lot of factors to consider before they make their final decision.
One of the most important factorsis the weather. It is undesirable to travel under extremely high temperature. They always try to avoid going to the hottest place. However, it is unavoidable sometimes as it might be on the only way to the destination. To decide where to go, they will pick a route that the highest temperature is minimized. If more than one route satisfy this criterion, they will choose the shortest one.
There are several oases in the desert where they can take a rest. That means they are travelling from oasis to oasis before reaching the destination. They know the lengths and the temperatures of the paths between oases. You are to write a program and plan the route for them.

Input
Input consists of several test cases. Your program must process all of them.
The first line contains two integers N and E (1 ≤ N ≤ 100; 1 ≤ E ≤ 10000) where N represents the number of oasis and E represents the number of paths between them. Next line contains two distinct integers S and T (1 ≤ S, T ≤ N) representing the starting point and the destination respectively. The following E lines are the information the group gathered. Each line contains 2 integers X, Y and 2 real
numbers R and D (1 ≤ X, Y ≤ N; 20 ≤ R ≤ 50; 0 < D ≤ 40). It means there is a path between X and Y , with length D km and highest temperature RoC. Each real number has exactly one digit after the decimal point. There might be more than one path between a pair of oases.

Output
Print two lines for each test case. The first line should give the route you find, and the second should contain its length and maximum temperature.

Sample Input
6 9
1 6
1 2 37.1 10.2
2 3 40.5 20.7
3 4 42.8 19.0
3 1 38.3 15.8
4 5 39.7 11.1
6 3 36.0 22.5
5 6 43.9 10.2
2 6 44.2 15.2
4 6 34.2 17.4

Sample Output
1 3 6
38.3 38.3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值