Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: idinkinjai

Problemset: Bakushin's Genius Game

Language: cpp

Time: 0.010 second

Submitted On: 2025-10-18 10:51:13

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;cin>>t;
    for (int i=0;i<t;i++){
        char winner;
        long long n;
        cin>>n;

        bool aturn=1;
        while(true){
            if (aturn){
                if (n==0){
                    winner = 'B';
                    break;
                }
                else {
                    if (n>2 && n%2==0){
                        n=2;
                        aturn=0;
                    }
                    else {
                        n-=1;
                        aturn=0;
                    }
                }
            }
            else {
                if (n==0){
                    winner = 'A';
                    break;
                }
                else {
                    if (n>2 && n%2==0){
                        n=2;
                        aturn=1;
                    }
                    else {
                        n-=1;
                        aturn=1;
                    }
                }
            }
        }
        cout <<winner;
        if (i!=t-1) cout <<"\n";
    }

    return 0;
}