当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1292:Will Indiana Jones Get There?

题目描述
Indiana Jones is in a deserted city, annihilated during a war. Roofs of all houses have been destroyed and only portions of walls are still standing. The ground is so full of mines that the only safe way to move around the city is walking over the remaining walls. The mission of our hero is to save a person who is trapped in the city. In order to move between two walls which are not connected Indiana Jones thought of taking with him a wooden board which he could place between the two walls and then cross from one to the other.

Initial positions of Indiana Jones and the trapped person are both on some section of the walls.Besides, walls are either in the direction South-North or West-East.
You will be given a map of the city remains. Your mission is to determine the minimum length of the wooden board Indiana Jones needs to carry in order to get to the trapped person.
输入解释
Your program should process several test cases. Each test case starts with an integer N indicating the number of wall sections remaining in the city (2 <= N <= 1000). Each of the next N lines describes a wall section. The first wall section to appear is the section where Indiana Jones stands at the beginning.The second section to appear is the section where the trapped person stands. Each wall section description consists of three integers X,Y and L (-10000 <= X ,Y ,L <= 10000), where X an Y define either the southernmost point of a wall section (for South-North sections) or the westernmost point (for West-East wall sections). The value of L determines the length and direction of the wall: if L >= 0,the section is West-East, with length L; if L < 0, the section is North-South, with length |L|. The end of input is indicated by N = 0.
输出解释
For each test case in the input your program should produce one line of output, containing a real value representing the length of the wooden board Indiana Jones must carry. The length must be printed as a real number with two-digit precision, and the last decimal digit must be rounded. The input will not contain test cases where differences in rounding are significant.
输入样例
14
1 1 5
6 8 2
7 2 -2
5 3 3
2 5 2
2 3 2
2 3 -2
4 3 -2
0 7 1
1 8 2
3 6 -2
4 7 2
6 6 1
6 6 -2
3
-10 0 20
-5 1 10
50 50 100
0
输出样例
1.41
1.00

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 South America 2002

源链接: POJ-1292

最后修改于 2020-10-29T06:00:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000