stones
Problem
There are N
stones on the table. During a move a player can take:
- 1 or 2 stones if N
is divisible by 3;
- 1 or 3 if N
when divided by 3 gives remainder one;
- 1, 2 or 3 if N
when divided by 3 leaves a remainder of two.
Each move can be made if there are enough stones. The one who cannot make a move loses.
Input: Enter an integer \(0 < N <= 100\).
Output: print 1 or 2 – the number of the player who will win if played correctly.
Examples
# |
Input |
Output |
1 |
1 |
1 |
2 |
3 |
2 |