WOJ1296-Coins
来源:互联网 发布:淘宝店怎么打造爆款 编辑:程序博客网 时间:2024/06/15 19:36
Snoopy has three coins. One day he tossed them on a table then and tried to flip some
of them so that they had either all faces or all backsides facing up. After several
attempts, he found that regardless of the initial configuration of the coins, he could
always achieve the goal by doing exactly two flippings, under the condition that only
one coin could be flipped each time and a coin could be flipped more than once. He also
noticed that he could never succeed with less than two flippings.
Snoopy then wondered, if he had n coins, was there a minimum number x, that he could
do exactly x flippings to satisfy his requirements?
输入格式
The input contains multiple test cases. Each test case consists of a single positive
integer n (n < 10,000) on a separate line. A zero indicates the end of input and should
not be processed.
输出格式
For each test case output a single line containing your answer without leading
or trailing spaces. If the answer does not exist, output
样例输入
230
样例输出
No Solution!2
#include<stdio.h>int main(){int n; while(scanf("%d",&n)==1&&n!=0) if(n%2==0) printf("No Solution!\n"); else printf("%d\n",n-1); return 0;}
- WOJ1296-Coins
- Coins
- Coins
- Coins
- Coins
- coins
- Coins
- Coins
- Coins
- Coins
- Gold Coins
- Flip coins
- PKU_2000_Gold Coins
- HDU_1398_Square Coins
- Square Coins
- poj1742 - Coins
- poj1724(Coins)
- uva_562Dividing coins
- 数据结构与算法
- 51Nod 1298 圆与三角形
- Java中理解IO工作原理示意图
- 【Java】虚拟机执行引擎
- 盲评的办法
- WOJ1296-Coins
- 异步消息处理机制
- JAVA 1 笔记
- 【JMeter 菜鸟实操之五】ant+jenkins 完善html结果报告
- 如何构建用户画像
- Nodejs express获取Ajax(post方式)发送的数据
- RESTful的理解和设计
- WOJ1299-Merge Apple
- Java-工具类之ZIP压缩解压