
The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains 3 space-separated integers ‘n’, ‘R’ & ‘r’
For each test case, print Yes if the table can accommodate the given number of plates else print No.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10^5
1 <= n <= 10^6
1 <= r <= 10^9
1 <= R <= 10^9
1 <= r <= R
Time Limit: 1 sec
Since each plate must touch the table, the center of these plates will lie in a circle of Radius ( R - r ).
Let us say, all the n plates can be accommodated on the table. In this case, all the plates will touch each other and their center will form a regular polygon.
Now, consider the right angled triangle ABO formed in the figure below :
Clearly, AB = r, AO = R - r and Angle(ABO) = 90 degrees
Also, since we need to place n plates, the center angle will be divided into n equal parts, so
Angle ( AOB ) = PI / n.
Now, we apply trigonometry in the above triangle :
But, since this is the case for most plates to fit, we can derive the general rule as :
If the above equality holds, then we can return true as all plates can be placed on the table, else we return false.
Algorithm :
Pair Product Div by K
Pair Product Div by K
Merge Two Sorted Arrays Without Extra Space
Merge Two Sorted Arrays Without Extra Space
Co-Prime
First Digit One
Special Digit Numbers