Description
Your task is to judge whether a regular polygon can be drawn only by straightedge and compass.
The length of the straightedge is infinite.
The width of the compass is infinite.
The straightedge does not have scale.
Input
There are several test cases. Each test case contains a positive integer n (3<=n<=10^9). The input will be ended by the End Of File.
Output
If the regular polygon with n sides can be drawn only by straightedge and compass, output YES in one line, otherwise, output NO in one line.
Sample Input 
3 4 5 6 7
Sample Output
YES YES YES YES NO
分析:正 N 边形可用直尺和圆规作出,当且仅当 N = 2m p1 p2 ...... pk
其中 p1,
p2,
......, pk 是互异的费马素数,即形如 的素数。
迄今为止只找到了 F0 = 3, F1 = 5, F2 = 17, F3 = 257, F4 = 65537 这五个费马素数
#include <cstdio>
const int fima[] = {3, 5, 17, 257, 65537};
int main()
{
int x;
while(~scanf("%d", &x)) {
int yes = 0;
for(int i=0; i<5; i++) if(x%fima[i]==0) x/=fima[i];
for(int i=0; i<30; i++) if((x==(1<<i))) { yes = 1; break; }
printf("%s\n", yes?"YES":"NO");
}
return 0;
}