Alice and Bob is playing a game with marbles; You are played this game in childhood. The game is playing by alternating turns. In each turn a player can take exactly one or both marbles.
Both Alice and Bob know the number of marbles initially. Now the game can is started by any one. But the winning condition depends on the player starts it. If Alice starts first, then the player takes the last marble looses the game. If Bob starts first, then the player takes the last marble wins the game.
Now is given the initial number of marbles and the name of the player who starts first. Then you have to find the winner of the game if both of them play optimally.
Input
Input starts with an integer T (≤10000), denoting the number of test cases.
Each case contains a integer n (1≤n < 231) and the name of the player who starts first.
Output
For each case, print the case number and the name of the winning player.
Sample Input
Output for Sample Input
3
1 Alice
2 Alice
3 Bob
Case 1:bob
Case 2:alice
Case 3:alice
Find a circular section directly
/************************************************************************* > File Name:LightOJ1020.cpp > Author:alex > Mail:zchao1995@gmail.com > Created time:2015 June 09 Tuesday 18:46 32 sec * * /#include <functional> #include < algorithm> #include <iostream> #include <fstream> #include <cstring> #include <cst
dio> #include <cmath> #include <cstdlib> #include <queue> #include <stack> #include <map> #include <bitset> #include <set> #include <vector> using namespace
Std
Const double PI = ACOs (-1.0);
const int inf = 0X3F3F3F3F;
Const double EPS = 1e-15;
typedef long Long LL;
typedef pair <INT, int> PLL;
int main () {int T, icase = 1;
scanf ("%d", &t);
while (t--) { int n;
string S;
CIN >> N >> S;
n%= 3;
cout << "Case" << icase++ << ":";
if (s[0] = = ' A ') {if (n = = 1) {printf ("bob\n");
} else {printf ("alice\n");
}} else {if (n = = 0) {printf ("alice\n");
} else {printf ("bob\n");
}}} return 0;
}