Description:
The Tower shows a tall tower perched on the top of a rocky mountain. Lightning strikes, setting the building alight, and two people leap from the windows, head first and arms outstretched. It is a scene of chaos and destruction.
There is a cone tower with base center at (0, 0, 0), base radius r and apex (0, 0, h). At time 0 , a point located at (x0x0, y0y0, z0z0) with velocity (vxvx, vyvy, vzvz). What time will they collide? Here is the cone tower.Input
The first line contains testcase number TT (TT ≤ 1000), For each testcase the first line contains spaceseparated real numbers rr and hh (1 ≤ rr, hh ≤ 1000) — the base radius and the cone height correspondingly.
For each testcase the second line contains three real numbers x0x0, y0y0, z0z0 (0 ≤ |x0x0|, |y0y0|, z0z0 ≤ 1000). For each testcase the third line contains three real numbers vxvx, vyvy, vzvz (1 ≤ v2xvx2 + v2yvy2 + v2zvz2 ≤ 3 × 106106). It is guaranteed that at time 0 the point is outside the cone and they will always collide.Output
For each testcase print Case ii : and then print the answer in one line, with absolute or relative error not exceeding 10−610−6
Sample Input
2 1 2 1 1 1 -1.5 -1.5 -0.5 1 1 1 1 1 -1 -1 -1
Sample Output
Case 1: 0.3855293381 Case 2: 0.5857864376
给出一个圆锥体的半径和高,圆锥的地面圆心在坐标轴原点,又给出了一个质点的坐标和移动速度,求最短经过多长时间可以使质点和圆锥相交。
设ttt为碰撞时间,建立圆锥曲面和运动轨迹的方程,联立方程解。则运动轨迹方程组为:圆锥曲面方程组为:
化简然后求t
AC代码: