编程介的小学生 2019-12-21 11:35 采纳率: 20.5%
浏览 188

Shortest Path on a Cylinder 圆柱的问题

Problem Description
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.

Input
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.

Output
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.

Sample Input
2
5 10
10 0 3
5 0 5
90 49
49 312 39
0 52 65

Sample Output
Case #1: 7.00
Case #2: 171.02

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。