Problem J |
Find the Latitude |
Time Limit |
1 Second |
We are dealing with a very well known problem here. A man lives in a hut. On one fine morning he wakes up goes n km to the north, and then he goes n km to the east and then he goes n km to the south to reach his hut again. Your job is to determine the latitude of his hut. You can assume that the man lives on a planet which is a perfect sphere and the man can walk at any location of his planet (no seas, no mountains, no check points, only plain land). If there is more than one solution you just need to find the first 10 smaller solutions. One obvious solution is the south pole. We don't need that.
Input
The input file contains several
lines of inputs. Each line contains two integers R (0<R<100000)
and n (R/100<=n<=R/8). Here R is the radius of earth in km
and n is the distance covered in km in each journey as described
in the problem statement. Input is terminated by a line where R=0 and n=0.
For each line of input first produce the serial of the output as shown in the sample output. Then produce at most 10 lines, which contain the latitude of the man’s house in degree. The degree values should have five digits after the decimal point.
Sample Input |
Output for Sample Input |
1000 10 1000 20 0 0 |
Case 1: 89.33585 89.38145 89.39665 89.40424 89.40880 89.41184 89.41402 89.41564 89.41691 89.41792 Case 2: 88.67171 88.76290 88.79329 88.80849 88.81761 88.82369 88.82803 88.83129 88.83382 88.83585 |
Problemsetter: Shahriar Manzoor
Member of Elite Problemsetters' Panel
Hint:
Consider a parallel on the northern Hemisphere that has a circumference of n mile (Parallel A in the figure below). We can select an arbitrary point on this parallel, move one mile south to another parallel (parallel B in figure below). This is a possible position of the man’s tent. I mean the man’s tent can be anywhere on this parallel. Other such parallel can be found using similar approach.