All submissions for this problem are available.
26 September 1983 : Soviet Union Early Warning Satellite Systems have just detected that the United States has launched a Nuclear Intercontinental Ballistic Missile towards them. Stanislav Petrov, a lieutenant colonel in the Soviet Air Defense Forces stationed at the Serpukhov-15 bunker near Moscow, erroneously concluding (thus diverging from real history) that World War 3 has started, triggers emergency protocols for a retaliatory strike in accordance with the strategy of mutually assured destruction.
Given the coordinates of the Soviet Missile Silo, and those of the target (typically in the NATO territory) both of which are on the surface of the Earth, your task is to determine the total distance that the missile will need to cover before reaching the target. The missile follows a trajectory along the circumference of a circle, reaching its maximum height (above the Earth's surface) when the missile has covered exactly half the distance from the source to the target.
Each line of input will contain 1 test case, consisting of 5 integers: x1, y1, x2, y2 & z. (xi,yi) are the coordinates (latitude and longitude in degrees) of the source (i=1) & target (i=2). z is the maximum height (in kilometers, 0<=h<2000) above the Earth's Surface that the missile can reach. Keep reading input till EOF.
Corresponding to each test case, output 1 line, containing the total distance that the missile will cover on its trajectory from the source to the target. The output value should be in kilometers and contain only 3 digits beyond the decimal point.
Note : Radius of the Earth = 6,371 km
0 0 90 0 0
90 0 0 90 100
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, GO, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.