Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: qweqwe
Problemset: Bakushin's Genius Game
Language: cpp
Time: 0.010 second
Submitted On: 2025-10-21 11:13:26
#include <bits/stdc++.h>
#define speed cin.tie(0)->sync_with_stdio(0)
#define ll long long
#define pii pair<int,int>
using namespace std;
int finddiv(int n){ // find the max div for n
if (n<2 || n%2==1) return -1;
for (int i=2;i<=sqrt(n);i+=2){
if (n%i==0) return i;
}
return -1;
}
// top 5 problem oat lmao
int main(){
speed;
int t;cin >> t;
for (int i=0;i<t;i++){
int n;cin >> n;
int temp=n;
bool turns=0; // bakushin,agnes = 0,1
while (n!=0){
int div=finddiv(n);
if (div==-1) n--;
else n=div;
turns=!turns;
//cout << n << " " << turns << "\n";
}
if (!turns) cout << 'B' << "\n"; // bakushin win
else cout << 'A' << "\n"; // agnes win
}
return 0;
}