首页 > 其他 > 详细

Graph(2014辽宁ACM省赛)

时间:2014-05-26 05:29:09      阅读:387      评论:0      收藏:0      [点我收藏+]

问题 F: Graph

时间限制: 1 Sec  内存限制: 128 MB
提交: 30  解决: 5
[提交][状态][论坛]

题目描述

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.

输入

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.

输出

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.

样例输入

34567

样例输出

YESYESYESYESNO



坑大爹的一题,该死的费马数。。。。。。

p=2^n;
或 p=(2^n)*m; m为若干个不相同的费马数的积
//满足要求的边为 (2^n)*p p为费马素数
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        while(n%2==0)
        {
            n/=2;
        }
        if(n==1)
        {
            printf("YES\n");
            continue;
        }
        if(n%3==0)
            n/=3;
        if(n%5==0)
            n/=5;
        if(n%17==0)
            n/=17;
        if(n%257==0)
            n/=257;
        if(n%65537==0)
            n/=65537;
        if(n==1)
        {
            printf("YES\n");
        }
        else
            printf("NO\n");
    }
    return 0;
}


Graph(2014辽宁ACM省赛),布布扣,bubuko.com

Graph(2014辽宁ACM省赛)

原文:http://blog.csdn.net/asdfghjkl1993/article/details/26616749

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!