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DDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
对于每一个出现次数多于 \(1\) 的颜色,直接隔空插入即可。
BABABABABABABABABABABABABABABABABABABABABABABABABA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BABABABABABABABABABABABABABABABABABABABABABABABABA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BABABABABABABABABABABABABABABABABABABABABABABABABA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BABABABABABABABABABABABABABABABABABABABABABABABAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
显然可插入的个数是大于 \(100\) 的。
#include <bits/stdc++.h>
#define file(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
#define quad putchar(' ')
#define Enter putchar('\n')
int ans[55][55];
struct Node {
int pos, num;
}node[5];
signed main(void) {
for (int i = 0; i < 4; i++) {
std::cin >> node[i].num;
node[i].pos = i;
}
int n = 40, m = 50;
std::cout << n << " " << m << std::endl;
for (int col = 0; col <= 3; col++)
for (int i = 1; i <= 10; i++)
for (int j = 1; j <= m; j++)
ans[col * 10 + i][j] = col;
for (int i = 0; i <= 4; i++)
node[i].num --;
for (int i = 0; i <= 3; i++) {
int front = (i + 3) % 4;
int fx, fy;
fx = front * 10 + 1; fy = 1;
for (int j = 1; j <= node[i].num; j++) {
ans[fx][fy] = i;
// printf ("%d %d\n", fx, fy);
if (fy + 2 <= 50) fy += 2;
else fx += 2, fy = 1;
}
}
for (int i = 1; i <= n; i++, Enter)
for (int j = 1; j <= m; j++)
printf("%c", 'A' + ans[i][j]);
}