poj3372
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 5868 | Accepted: 3274 |
Description
N children standing in circle who are numbered 1 through N clockwise are waiting their candies. Their teacher distributes the candies by in the following way:
First the teacher gives child No.1 and No.2 a candy each. Then he walks clockwise along the circle, skipping one child (child No.3) and giving the next one (child No.4) a candy. And then he goes on his walk, skipping two children (child No.5 and No.6) and giving the next one (child No.7) a candy. And so on.
Now you have to tell the teacher whether all the children will get at least one candy?
Input
The input consists of several data sets, each containing a positive integer N (2 ≤ N ≤ 1,000,000,000).
Output
For each data set the output should be either "YES" or "NO".
Sample Input
- 2
- 3
- 4
Sample Output
- YES
- NO
- YES
Source
- #include<cstdio>
- using namespace std;
- int main()
- {
- int n;
- while(scanf("%d",&n)==)
- {
- while(n%==)
- n/= ;
- if(n==)
- printf("YES\n");
- else
- printf("NO\n");
- }
- return ;
- }
poj3372的更多相关文章
- poj3372 Candy Distribution
可以证明: f(k) = k *(k - 1)/ 2 (1 ≤ k ≤ n)是n的完全剩余系当且仅当n = 2 ^ t. http://poj.org/problem?id=3372
随机推荐
- 彻底删除Oracle 11g的方法
1.关闭oracle所有的服务. 可以在windows的服务管理器中关闭. 2.打开注册表:regedit 打开路径:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlS ...
- 小强升职记(GTD)脑图
- sphinx设置多属性过滤的方法(setFilter)
需求描述 mysql中,每一个文档都有多个标签,查询时可以筛选一个标签也可以筛选同时拥有多个标签的文档. 数据示例 文档 标签 1 1,2,3,4,5 2 2,3,4,5,6 ...
- Solr3.6.2和Solr4.9.0经常使用配置
tomcat 以tomcat 7为例,位置/work/apache-tomcat-7.0.55 Solr 3.6.2 基本配置 Solr 3.6.2.须要JDK 6/JDK7支持. 下载Solr 3. ...
- CORS解决WebApi跨域问题(转)
CORS全称Cross-Origin Resource Sharing,中文全称跨域资源共享.它解决跨域问题的原理是通过向http的请求报文和响应报文里面加入相应的标识告诉浏览器它能访问哪些域名的请求 ...
- Centos系统安装JDK详细图文教程
1.查询系统默认JDK Centos系统默认会安装OpenJDK,一般建议是安装sun公司的JDK.我们首先检查系统是否安装有jdk并且是OpenJDK版本的,若是,则将它卸载掉并安装上sun公司的j ...
- Mac Yosemite上安装macvim和YouCompleteMe
今天在macvim上安装YouCompleteMe的时候,碰到一个运行vim崩溃的错误.查了半天终于解决! 先上一下安装macvim的过程 # install xcode and command li ...
- Atitit.跨语言异常转换机制 java c# php到js的异常转换
Atitit.跨语言异常转换机制 java c# php到js的异常转换 1. bizEx 直接抓取,然后js catchEX1 2. Chkec runtimeEx1 3. Other异常..J ...
- vivado编译出错 [Synth 8-729] [Synth 8-787]
http://www.cnblogs.com/pejoicen 打开vivado工程后,发现右上角如下图所示: 重新编译这两个ip核后,对整个工程synthesis,工程报错 [Synth 8-7 ...
- vivado笔记
Vivado主界面 Vivado套件,相当于把ISE.ISim.XPS.PlanAhead.ChipScope和iMPACT等多个独立的套件集合在一个Vivado设计环境中,在这个集合的设计流程下,不 ...