规律题_1
来源:互联网 发布:cp1200写频软件下载 编辑:程序博客网 时间:2024/06/05 07:14
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
23 4
Sample Output
YESNOYES
<pre name="code" class="cpp">#include<iostream>#include<cstring>using namespace std;int main(){ int n; while(cin>>n) { while(n%2==0){ n=n/2; } if(n==1) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0;}
- 规律题_1
- 【规律题】
- 规律题
- 规律题
- 算法笔试题_1
- C/C++笔试题_1
- 第八章课后题_1
- SOJ2506 规律题
- HDU 2582 规律题
- 蟠桃记 + 规律题
- HDU1005.规律题
- hdu1005(找规律题)
- hdu 1792规律题
- hdu 4925规律题
- 数学+找规律题
- Hduoj2709【规律题】
- CSU 规律题
- lightOJ 1005 【规律题】
- 模板消息
- centos 同步外网源到本地
- 字符串训练(二)模拟实现strstr strncpm strncat strncpy函数
- OpenStack Glance 之paste
- 让Apache的commons-net-3.3中的FTPClient支持中文
- 规律题_1
- EXT.NET MVC5 工作随笔08 关于前台上传多个图片和单个图片的写法
- hdu 5795 A Simple Nim
- 六度分离
- 浅谈微信卡券功能开发(1)
- vmstat命令的输出解释
- MySQL技术内幕InnoDB存储引擎学习笔记(第六章)
- CUDA编程_DEBUG_01
- 监听activeMQ的状态