Description
Alice and Bob decide to play a funny game. At the beginning of the game they pick N (1 <= n <= 106) Coins in a circle, as Figure 1 shows. A move consists in removing one or both adjacent coins, leaving all other coins untouched. At least one coin must is removed. Players alternate moves with Alice starting. The player is removes the last coin wins. (The last player to move wins.) If you can ' t move, you lose.)
Figure 1
Note: For n > 3, we use C1, c2, ..., cn to denote the coins clockwise and if Alice remove C2, then C1 and C3 is not adjace Nt! (Because there is a empty place between C1 and C3.)
Suppose that both Alice and Bob does their best in the game.
You is to write a program to determine who'll finally win the game.
Input
There is several test cases. The which contains a positive integer n (1 <= n <= 106). There is no blank lines between cases. A line with a single 0 terminates the input.
Output
For each test case, if Alice win the Game,output "Alice", otherwise output "Bob".
Sample Input
1230
Sample Output
Alicealicebob
#include <cstdio>int main () {int n;while (scanf ("%d", &n) && N) {if (n <= 2) puts ("Alice"); else puts ( "Bob"); return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
POJ-2484 A Funny Game