Submission

Status:

TTTTTTTTTTTTTTTTTTTT

Subtask/Task Score:

0/100

Score: 0

User: qweqwe

Problemset: Bakushin's Genius Game

Language: cpp

Time: 1.097 second

Submitted On: 2025-10-21 10:54:38

#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==1) return 1;
	for (int i=n-1;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=1; // 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;
}