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

建议使用的浏览器:

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

4017:Shortest Path on a Cylinder

题目描述
Ant Smart is on a surface of cylinder now. He wants to move to another position of the cylinder’s surface. Like many other animals named Smart, he wants to find out the shortest path from one point to another.
Unfortunately, Ant Smart is not enough smart to solve this question now. It is your task to find out the answer.
输入解释
There are several test cases in this problem. The first line of input contains a single integer denoting the number of test cases.
For each test case, the first line contains two integers: radius and height (1<=radius<=100, 1<=height<=100), denoting the radius and height of the cylinder.
For the next two lines, each line contains three integers: h, a and r (0 <= h <= height, 0 <= a < 360, 0 <= r <= radius), denoting one point on the surface of cylinder each. The h indicates a circle on the surface of cylinder which apart h from the bottom. And the polar angle a and radius r indicates the position of the point on the circle. In the other words, if the cylinder is (0,0,0) - (0,0,height) on the 3D grid coordinate. The point can be represented as (cos(a)*r, sin(a)*r, h).
You may assume that r!=radius only when h=0 or h=height for each point.

Warning: There are about one thousand test cases. Be careful with the time efficiency.
输出解释
For each test case, output only one line contains the length of the shortest path on the surface of cylinder. The answer should be rounded to two digits after the decimal point.
输入样例
2
5 10
10 0 3
5 0 5
90 49
49 312 39
0 52 65
输出样例
Case #1: 7.00
Case #2: 171.02
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4017

最后修改于 2020-10-25T23:09:18+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
40000/20000MS(Java/Others) 65768/65768K(Java/Others)