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.
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.
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.
Input: 1 4
0 0 Output: 2.61
As two other people have said, use sin instead of cos formula, and use PI = acos(-1)
π is not 3.14159265358979 but 3.14159265358979323846264338327950288. Cost me 1 WA
Use double instead of float. As many others said, take care the value of Phi.
50th...in one go...just be careful about value of pi n take float...
Using M_PI in C++ is a must
that was the easy one AC in 1 go :)
AC in 1st go..... :p
Using pi=3.145926 & cosine formula give me 2 WA...So plz ...SINE Formula@@@@