Problem Description
Description
Yougth and Hrdv play a game. They take n stones and arrange them in a circle. Yougth and Hrdv take stones from it in turn; whoever takes the last one wins. On each turn, a player may take one stone or two adjacent stones. Hrdv goes first. Output the winner’s name.
Input
Input contains multiple test cases.
Each test case contains one n, guaranteed to be within the int range.
Output
Output the winner’s name.
Sample Input
| |
Sample Output
| |
Problem Analysis
The difference from normal stone taking is
that although each turn allows taking one or two
the two taken must be adjacent
and the stones initially form a circle
so the second player can “split” the stones
to prevent the first player from taking two at the key point

If the first player takes 1
then the second player takes 4
then the first player can only take 2 or 3
so the second player takes the other one and wins
The same reasoning extends to more stones
as long as the second player cuts the stones into two parts
the second player can win
So except when n is 1 or 2, where the first player wins directly
the second player can win in all other cases
| |
Problem address: NYOJ 833 Stone Taking (Seven)