1067 Bash game V2 base time limit: 1 seconds space limit: 131072 KB Score: 10 Difficulty: 2-level algorithm problem collection attention to a heap of stones total N. A B Two people take turns, a take first. Each time can only take 1,3,4, to get the last 1 stones of the people to win. Suppose a B is very clever, there is no mistake in the process of taking the stone. Give N and ask who can win the game at the end. For example n = 2. A can only take 1, so B can get the last 1 stones. Input
Line 1th: A number t that represents the number of numbers that are later used as input tests. (1 <= T <= 10000)
2-t + 1 lines: 1 numbers per line N. (1 <= N <= 10^9)
Output
A total of T-lines, if a WINS output A, if B wins output B.
Input example
3
2
3
4
Output example
B
a
a
Idea: The game problem to find strange situation is good (must defeat the situation) first can be seen 2. Is a must defeat, then 5 because 5 regardless of 1 2 4 What value, can not be the opponent to face the strange situation, then the 7,9, 11, 16 himself will be able to see the law +2 + 5 +2 + 5 So find the law is Can
#include <iostream>
#include <stdio.h>
using namespace std;
int main ()
{
int T;
cin>>t;
while (t--)
{
int n;
cin>>n;
if (n%7==0| | n%7==2)
cout<< "B" <<endl;
else
cout<< "A" <<endl;
}
/* int i=1,j=0;
int a=2;
while (a<100)
{
if (j>=i)
{
i++;
a+=2;
}
else
{
J + +;
a+=5;
}
cout<<a<<endl;
} */
return 0;
}