UCV2013I - Tambourine
Little HH loves tambourines. He loves them so much that now he wants to build them. A tambourine is a musical instrument shown in Figure 1(a). As you can see in Figure 1(b) the tambourine is just a big circle of radius R with N smaller circles of radius r (r < R).
Figure 2: (a) A tambourine. (b) The radius of the circles is shown. (c) There is a 2N sides regular polygon inscribed in the outer circle
HH knows the radius of the small circles (r), he also knows the number of small circles that he has (N). And he knows that the small circles should be centered on the center of the even sides of a 2N sides regular polygon inscribed in the big circle (the sides of this polygon each measuring 2r), as shown on Figure 1(c). Now HH wants you to help him find the radius R of the big circle.
Input
The input contains several test cases. Each test case consists of two values r and N as described previously. (0 < r <= 100), (2 <= N <= 10000).
The end of input is indicated by a test case with r = N = 0.
Output
For each test case you must print a number (rounded up to two decimal places) showing the radius of the big circle to build the tambourine.
Example
Input: 1 4
2 4
1 8
0 0 Output: 2.61
5.23
5.13
hide comments
Adam D:
2013-08-12 16:07:25
second image is misleading ..... |
|
auror:
2013-08-11 13:34:07
some test case pls..
|
|
albertg:
2013-08-05 14:44:36
Silly mistake costed me WA!!! Be careful with value of Pi.
|
|
shanu jain:
2013-08-03 09:12:21
regular polygon :D
|
|
Sandeep Kumar:
2013-08-01 07:57:45
easy problem !!!
|
|
Prateek chandan:
2013-07-31 09:24:33
Simple.. think less .. :P Last edit: 2013-08-07 12:43:28 |
|
Anmol Agarwal:
2013-07-30 20:23:21
r can be 0... be careful..... caused me i wa......
|
|
Nick:
2013-07-30 13:22:42
Nice :D
|
|
chk:
2013-07-29 15:59:23
easy one
|
Added by: | Hector Navarro |
Date: | 2013-07-22 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Local UCV 2013. Héctor Navarro |