-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol_ac2019.cpp
More file actions
47 lines (45 loc) · 938 Bytes
/
sol_ac2019.cpp
File metadata and controls
47 lines (45 loc) · 938 Bytes
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
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
int numTest;
int n, D;
char a[20][20];
int main () {
std::cin >> numTest;
for (int testCase = 1; testCase <= numTest; testCase++) {
std::cin >> D >> n;
D = 15;
std::cout << D << ' ' << D << std::endl;
for (int i = 1; i <= D; i++) {
for (int j = 1; j <= D; j++) {
a[i][j] = 'C';
if (j % 4 == 1) {
a[i][j] = 'A';
}
}
}
for (int i = 2; i < D; i++) {
for (int j = 2; j <= D; j += 2) {
if (n >= 3) {
a[i][j] = 'B';
n -= 3;
}
}
}
for (int j = 2; j <= D; j += 2) {
if (n > 0) {
a[1][j] = 'B';
n--;
}
if (n > 0) {
a[D][j] = 'B';
n--;
}
}
for (int i = 1; i <= D; i++) {
for (int j = 1; j <= D; j++) {
std::cout << a[i][j];
}
std::cout << std::endl;
}
}
return 0;
}