#include <iostream>
using namespace std;
int debug = 1;
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
int a, b;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
cin >> b;
int r = int(a / 2) + (a % 2 == 1 ? 1 : 0);
if (b < r) {
cout << "NIE" << endl;
} else {
for (int j = 0; j < r; j++) {
cout << "A";
}
for (int j = r; j < a; j++) {
cout << "P";
}
cout << endl;
}
}
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <iostream> using namespace std; int debug = 1; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n; int a, b; cin >> n; for (int i = 0; i < n; i++) { cin >> a; cin >> b; int r = int(a / 2) + (a % 2 == 1 ? 1 : 0); if (b < r) { cout << "NIE" << endl; } else { for (int j = 0; j < r; j++) { cout << "A"; } for (int j = r; j < a; j++) { cout << "P"; } cout << endl; } } return 0; } |
English