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