60: noi.ac #69
$code$
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<climits> using namespace std; typedef long long LL; int n, m; char a[110][110]; bool flg[27]; inline char getans(int x, int y) { char ret = a[x][y]; if (!ret) { ret = 'A'; while (ret == a[x - 1][y] || ret == a[x + 1][y] || ret == a[x][y - 1] || ret == a[x][y + 1]) ++ ret; } return ret; } inline void cover(int x, int y) { char c = getans(x, y); putchar(c); if (a[x][y]) return; int sz = 1; while(x + sz <= n && y + sz <= m && getans(x, y + sz) == c) { sz ++; } sz --; for (int i = x; i <= x + sz; ++ i) for (int j = y; j <= y + sz; ++ j) a[i][j] = c; } int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++ i) { for (int j = 1; j <= m; ++ j) cover(i, j); putchar('\n'); } }