Submission

Status:

xxxxxxxxxxxxxxxxxxxx

Subtask/Task Score:

0/100

Score: 0

User: Hxluk.ka

Problemset: Bakushin's Genius Game

Language: cpp

Time: 0.003 second

Submitted On: 2025-12-10 12:57:29

#include <iostream>
#include <cmath>
using namespace std;
int t, n, turn, _max;
void solve() {
    turn = 0;
    cin>>n;
    while (n>0) {
        if (n%2) {
            n--;
        } else {
            for (int i = 0; i <= n/2; i+=2) {
                if (!n%i) _max=i;
            }

            n/=_max;
        }
        turn = !turn;
    }
    if (turn) cout << "A";
    else cout << "B";
    cout << '\n';
}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin>>t;
    for (int i = 0; i < t; i++) solve();
}