Pro.ID21987 TitleWorm on an Apple Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21987 AC0 Submit0 Ratio- 时间&空间限制描述An apple has the shape of a perfect sphere with the radius equal to 1. There is a worm located at some point A on the surface of the apple. The worm wants to move to the point B, also located on the surface of the apple. The worm may move in two fashions: - to crawl along the surface of the apple with the constant speed v0; - to gnaw a wormhole in the shape of a straight line segment from point A to point B. The inside of the apple consists of a core surrounded by the pulp. The core of the apple is also a perfect sphere, with the radius equal to P, and the center in the center of the whole apple. The worm can gnaw through the core with the speed v1 and through the pulp with the speed v2. Determine the minimal time the worm needs to get from the point A to the point B. The size of the worm can be neglected. 输入The first line contains the values of P (0 < P < 1, the value is given with up to 3 decimal places), v0, v1, and v2 (integers in the range from 1 to 100). The second and the third line give the points A and B, respectively, as two angles in the spherical coordinate system. The first angle, the azimuth φ (0 ≤ φ < 360°), gives the angle between the X axis and the projection on the XY plane of the segment connecting the origin to the corresponding point. The second angle, the polar θ (0 ≤ θ ≤ 180°), gives the angle between the Z axis and the segment connecting the origin to the corresponding point. The values φ and θ are integers and given in degrees. In all test cases where θ = 0 or θ = 180, φ is given as 0. 输出Description An apple has the shape of a perfect sphere with the radius equal to 1. There is a worm located at some point A on the surface of the apple. The worm wants to move to the point B, also located on the surface of the apple. The worm may move in two fashions: - to crawl along the surface of the apple with the constant speed v0; - to gnaw a wormhole in the shape of a straight line segment from point A to point B. The inside of the apple consists of a core surrounded by the pulp. The core of the apple is also a perfect sphere, with the radius equal to P, and the center in the center of the whole apple. The worm can gnaw through the core with the speed v1 and through the pulp with the speed v2. Determine the minimal time the worm needs to get from the point A to the point B. The size of the worm can be neglected. Input The first line contains the values of P (0 < P < 1, the value is given with up to 3 decimal places), v0, v1, and v2 (integers in the range from 1 to 100). The second and the third line give the points A and B, respectively, as two angles in the spherical coordinate system. The first angle, the azimuth φ (0 ≤ φ < 360°), gives the angle between the X axis and the projection on the XY plane of the segment connecting the origin to the corresponding point. The second angle, the polar θ (0 ≤ θ ≤ 180°), gives the angle between the Z axis and the segment connecting the origin to the corresponding point. The values φ and θ are integers and given in degrees. In all test cases where θ = 0 or θ = 180, φ is given as 0. Output The first and only line of the output should contain the minimal time of travel, accurate to 10-9. Sample Input Sample #1 Sample Output Sample #1 Source 样例输入Sample #1 样例输出Sample #1 作者 |