
You are given 3 Integers ‘n’, ‘R’ & ‘r’ where ‘n’ is the number of plates,
‘R’ is the radius of the table, and ‘r’ is the radius of the ‘n’ plates. The task is to find out whether the given table has enough space to accommodate the given number of plates of radius ‘r’. Consider the table and plates to be round and no plate can be placed above any other.
Each plate must be completely inside the table and must touch the edge of the table. Of course, the plates must not intersect, but they can touch each other.
You have to return true if the table can accommodate the given number of plates else return false.
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’
Output format :
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.
Note :
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
3
4 10 4
5 10 4
1 10 10
Yes
No
Yes
Test Case 1: n = 4 , R = 10 , r = 4
One of the possible arrangements can be :

Test case 2 : n = 5, R = 10, r = 4
From the above figure we can see that we can place no more plates with “r” = 4.
So, we print No.
Test case 3 : n = 1, R = 10, r = 10
Since R=r , and n=1 so we can place the only plate over the table such that it overlaps
with the table.
So, we print Yes.
2
2 10 5
10 10 10
Yes
No
Think about the constraint , each plate of radius r must touch the edge of the table.
Approach :
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.
Special Cases :
Algorithm :
O(1)
Since we are doing constant time operations, the overall time complexity is O(1).
O(1)
Constant extra space is required. Hence, the overall Space Complexity is O(1).