根据题意模拟即可。

#include <bits/stdc++.h>
using namespace std;
int a[112];
int main()
{
	int n;
	cin >> n;
	int s = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		s += a[i];
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= a[i]; j++)
			if (a[i] * 5 < s) cout << 'A';
			else cout << 'B';
		cout << endl;
	}
	return 0;
}