Banner Home Page Web Contests Problems Ranklist Status Statistics

Game

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 11   Accepted Submission(s) : 2
Problem Description


Two players(A and B) take turns to take stones form a heap of N stones.
</p>
<p>
There are some rules:<br>
1.A always takes first. He can take arbitrary number of stones but not all of them.<br>
2.The number of the one who will take should less than or equal the twice of the other one taken last time. But must more than one or one.<br>
3.The one who take take the last one stone is the winner.<br>
4.The two players are clever enough, they can make the best choice.<br>
</p>
<p><b>Input</b></p>
<p>
Every test case has only one line with one integer N(2 &lt= N &lt= 100000000), the numbers of the stones.
</p>
<p><b>Output </b></p>
<p>
If A will lose output "lose"
</p>
<p>
If A can win,output the numbers A should take at the first time. If there are more ways to make A win, output the smallest one.
</p>
<p><b>Sample Input</b></p>
<p>
4
</p>
<p><b>Sample Output</b></p>
<p>
1
</p>
<p><br>
</p>

 

Source
ZOJ Monthly, January 2005
 

Statistic | Submit | Back