Graph(2014辽宁ACM省赛)[通俗易懂]

Graph(2014辽宁ACM省赛)

大家好,又见面了,我是全栈君。


问题 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;
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/115482.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长

相关推荐

  • Linux学习笔记——进程查看及管理

    Linux学习笔记——进程查看及管理

    2021年9月9日
  • pt-online-schema-change 添加字段过程解析

    pt-online-schema-change 添加字段过程解析

    2022年3月12日
  • 武侠世界2-try catch思考

    以前一直不知道trycatch具体应用到什么地方,之前待过的几家公司也看不到有类似的代码。从网上搜来的,描述trycatch优点有下面几点。1、把错误处理和真正的工作分开来;  2、代码更易组织,更清晰,复杂的工作任务更容易实现;  3、毫无疑问,更安全了,不至于由于一些小的疏忽而使程序意外崩溃了;  4、由于C++中的trycatch可以分层嵌套,所以它…

    2022年4月6日
  • s3c2440时钟频率

    s3c2440时钟频率分类:LINUX++++++++++++++++++++++++++++++++++++++++++本文系本站原创,欢迎转载!转载请注明出处:http://blog.csdn.net/mr_raptor/article/details/6555734++++++++++++++++++++++++++++++++++++++++++系统时钟MINI2440开发板

    2022年6月14日
  • csgo88skins_csgo开箱网站yesskins

    csgo88skins_csgo开箱网站yesskins88skins国内CSGO开箱网站已合并至88steam官方链接:88skins.com取回状态:饰品需要兑换取回优惠码:csgo(注册使用GOGO推广码免费获得3-20元随机奖励)

    2022年10月5日
  • Eureka&CAP原理

    Eureka&CAP原理CAP原则(CAP定理):CAP原则又称CAP定理,指的是在一个分布式系统中,Consistency(一致性)、Availability(可用性)、Partitiontolerance(分区容错性),三者不可得兼。CAP原则是NOSQL数据库的基石。Consistency(一致性)。Availability(可用性)。Partitiontolerance(分区容错性)。分布式系

    2022年5月19日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号