Submit | All submissions | Best solutions | Back to list |
NAJAG - Alice Game |
Tonight, Alice and Bob are feeling so boring. Alice is a math student. So he suggested to play an interesting game. They play the following game.
They choose a number N to play with. The rules are as follows:
- In every game Bob starts first and the two players alternate.
- In his/her turn, a player chooses a number from 1, 2, 3, 5 and 7, which is less than N. And then subtract it from N. The number thus obtained is the new N.
- The person who cannot make a move in his/her turn loses the game.
Assuming both play optimally, who wins the game?
Input
The first line contains the number of test cases T ≤ 10000. Each of the next lines contains an integer N ≤ 1000000.
Output
Output T lines one for each test case, containing "ALICE" if Alice wins the game, or "BOB" if Bob wins the game. Don’t forget about case number.
Example
Input: 3 1 2 3 Output: Case 1: ALICE Case 2: BOB Case 3: BOB
Note : For the first test case, Bob cannot make any move and hence Alice wins the game. For the second test case, Bob subtracts 1 from N. Now, Alice cannot make a move and loses the game.
Added by: | Najmuzzaman |
Date: | 2015-03-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 JS-MONKEY |