Submission

Status:

TTTTTTTTTTTTTTTTTTTT

Subtask/Task Score:

0/100

Score: 0

User: FIrmTInn

Problemset: Bakushin's Genius Game

Language: cpp

Time: 1.099 second

Submitted On: 2025-10-08 22:35:48

#include<iostream>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t,n;
    int count = 0,step =0;
    cin >> t;
    for(int i=0;i<t;i++){
        cin >> n;
        if(n == 0){
            cout << 'B' << "\n";
            continue;
        }
        step =0;
        while(n != 0){
            //หา ตปก
            int d = 2;
            for(int i=n;i>=2;i--){
                if(i % 2 == 0 && n % i == 0){
                    d = i;
                }
            }
            if(n % 2 != 0){
                n = n-1;
                step++;
            }
            else{
                n = n/d;
                step++;
            }
        }
        if(step % 2 != 0){
            cout << "A\n";
        }
        else{
            cout << "B\n";
        }
        
    }





    return 0;
}