Time Limit: 4 second(s) | Memory Limit: 32 MB |
Alice and Bob are playing a strange game. The rules of the game are:
1. Initially there are n piles.
2. A pile is formed by some cells.
3. Alice starts the game and they alternate turns.
4. In each tern a player can pick any pile and divide it into two unequal piles.
5. If a player cannot do so, he/she loses the game.
Now you are given the number of cells in each of the piles, you have to find the winner of the game if both of them play optimally.
Input starts with an integer T (≤ 1000), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 100). The next line contains n integers, where the i^{th} integer denotes the number of cells in the i^{th} pile. You can assume that the number of cells in each pile is between 1 and 10000.
For each case, print the case number and 'Alice' or 'Bob' depending on the winner of the game.
Sample Input |
Output for Sample Input |
3 1 4 3 1 2 3 1 7 |
Case 1: Bob Case 2: Alice Case 3: Bob |
In case 1, Alice has only 1 move, she divides the pile with 4 cells into two unequal piles, where one pile has 1 cell and the other pile has 3 cells. Now it's Bob's turn. Bob divides the pile with 3 cells into two piles, where one pile has 1 cell and another pile has 2 cells. So, now there are three piles having cells 1, 1, 2. And Alice loses, since she doesn't have any moves now.
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |