Description
Gerald is setting the New Year table. The table has the form of a circle; its radius equalsR. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all plates to be round and have the same radii that equalr. 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. Help Gerald determine whether the table is large enough forn plates.
Input
The first line contains three integers n,R and r (1 ≤ n ≤ 100,1 ≤ r, R ≤ 1000) — the number of plates, the radius of the table and the plates' radius.
Output
Print "YES" (without the quotes) if it is possible to placen plates on the table by the rules given above. If it is impossible, print "NO".
Remember, that each plate must touch the edge of the table.
Sample Input
4 10 4
YES
5 10 4
NO
1 10 10
YES
Sample Output
NO YES
Hint
The possible arrangement of the plates for the first sample is: 小圆挨着大圆,是否可以放下n个
#include<cstdio>
#include<algorithm>
using namespace std;
#define pi acos(-1.0)
#include<cmath>
int main()
{
int n,R,r;
while(~scanf("%d%d%d",&n,&R,&r))
{
if(r>R){
if(n==0) printf("YES\n");
else printf("NO\n");
continue;
}
else if(r==R){
if(n<=1) printf("YES\n");
else printf("NO\n");
continue;
}
else if(4*r>2*R){
if(n<=1) printf("YES\n");
else printf("NO\n");
continue;
}
double m=(2.0*(R-r)*(R-r)-(2.0*r)*(2.0*r))/(2.0*(R-r)*(R-r));
//余弦定理
double a=acos(m);
if((n-2.0*pi/a)<1e-10)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}