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
随机推荐
- ORA-01400: 无法将 NULL 插入 ("CHARGE_WQRL"."SF_JMQTFY_T"."BH")
[ERROR] JmCheckManageDaoImpl:901 - java.sql.SQLException: ORA-01400: 无法将 NULL 插入 ("CHARGE_WQRL& ...
- Mysql报错......\xE6\x80\xBB\xE7\x9B\x91' for column...
Mysql添加表中字符报错:Incorrect string value: '\xE6\x80\xBB\xE7\x9B\x91' for column 'postName' at row 1 原因:字 ...
- 用squid配置代理服务器(基于Ubuntu Server 12.04)
怀揣着为中小企业量身定做一整套开源软件解决方案的梦想开始了一个网站的搭建.http://osssme.org/ 1. 安装squid $sudo apt-get install squid -y 注: ...
- EF 表联合查询 join
有两张表m_Dept.m_User,联合查询 linq方式.EF方式 private void Add() { List<m_Dept> lst = new List<m_Dept& ...
- Android 自己定义ViewGroup手把手教你实现ArcMenu
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37567907 逛eoe发现这种UI效果,感觉非常不错,后来知道github上有这 ...
- Ubuntu13.04使用Jlink和ST-Link V2烧写STM32F1x和STM32F4x
近期做研究openpilot和crazyflie2.0,都须要在Linux进行代码的编写和烧录,所以研究了下Linux下如何使用Jlink,还有开源的支持多个仿真器的openocd,可是困难重重.总是 ...
- Hibernate关联关系(二) Cascade级联
1.cascade定义的是关系两端对象到对象的级联关系:而inverse定义的是关系和对象的级联关系. all : 所有情况下均进行关联操作. none:所有情况下均不进行关联操作.这是默认值. ...
- Win7下更改iTunes备份路径最便捷的方法
① 先删除C:\Users\你的用户名\AppData\Roaming\Apple Computer里的 MobileSync文件夹(首次安装iTunes要先运行一次itunes,才有这个文件夹,如果 ...
- Atitit.执行cli cmd的原理与调试
Atitit.执行cli cmd的原理与调试 1. /c 与/k1 2. /k 参数,有利于调试1 3. -------code2 4. 打开程序后与openner脱离关系3 5. 返回参数 St ...
- [gj]来公司停电了-维护机器
停电出现的问题 一早来机房跳闸了. 很多vm手动起来后有些服务不太正常了. 机房锁坏了.不知道谁进去干啥了.导致跳闸 闸门不知道在哪里.导致所有机器停电了 牵扯到的技术点: 1,nexus启动. ng ...