A

来源:互联网 发布:yum 安装pure ftpd 编辑:程序博客网 时间:2024/06/05 23:44
Gerald is setting the New Year table. The table has the form of a circle; its radius equals R. 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 equal r. 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 for n 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 place n 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.

Example
Input

4 10 4OutputYESInput5 10 4OutputNOInput1 10 10OutputYES

Note

The possible arrangement of the plates for the first sample is:

这里写图片描述
因为pai定义的比较小,所以该题会出现精度问题

#include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>#define PI 3.1415926535int main(){    int R,r,n;    while(~scanf("%d %d %d",&n,&R,&r))    {        //double x;        if(n==1)        {            if(R>=r)                printf("YES\n");            else                printf("NO\n");            continue;        }        else if(n==2)        {            if(r*2<=R)                printf("YES\n");            else                printf("NO\n");            continue;        }       else       {            double t = 1.0*r/(R-r);///求角度            double x = asin(t);            if(2.0*PI - 2.0*x*n>-1e-9)///注意精度,不能是>=0            printf("YES\n");            else            printf("NO\n");       }    }    return 0;}
原创粉丝点击