Submission
Status:
T--TT-T-T-T-TTT-TTT-
Subtask/Task Score:
0/100
Score: 0
User: qweqwe
Problemset: Bakushin's Genius Game
Language: cpp
Time: 1.098 second
Submitted On: 2025-10-21 10:49:10
#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
for (int i=sqrt(n);i>=0;i--){
if (n%i==0) return n;
}
return 1;
}
// top 5 problem oat lmao
int main(){
speed;
int t;cin >> t;
bool turns=0; // bakushin,agnes = 0,1
for (int i=0;i<t;i++){
int n;cin >> n;
int temp=n;
while (n!=0){
int div=finddiv(n);
if (div==1) n--;
else n/=div;
turns=!turns; // change turn
}
if (!turns) cout << 'B' << "\n"; // bakushin win
else cout << 'A' << "\n"; // agnes win
}
return 0;
}