2419:Coins(翻译)

http://noi.openjudge.cn/ch0402/2419/

描述

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 heads or all tails 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有三枚硬币。一天他吧它们投到桌子上然后尝试从它们当中翻转一些来让他能使所有硬币背面或正面朝上。几次尝试之后,他发现无论最初的硬币情况是什么,他总能通过两次翻转达到目的,在这个条件下一枚硬币每次只能翻转一次并且一个硬币能翻转多次。他还注意到,他不可能在不到两次的情况下成功。

Snoopy then wondered, if he had n coins, was there a minimum number x such that he could do exactly x flippings to satisfy his requirements?

Snoopy想知道,如果他有n枚硬币,是否有一个最小的数字x,这样他就可以准确地翻转x次来满足他的要求?

输入

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.

输入包含多个测试用例。每个测试用例由单独一行上的一个正整数n(n<10000)组成。零表示输入结束,不应进行处理。

输出

For each test case output a single line containing your answer without leading or trailing spaces. If the answer does not exist, output “No Solution!

对于每个测试用例,输出包含答案的单行,不带前导或尾随空格。如果答案不存在,则输出“No Solution!”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值