题目大意:一栋大楼,有h层,每层有w*l大的格子,每个格子可以放一个工作室,有n个国家,每个国家可以有好几个工作室,要求,每个国家都有相邻的位置(上下层相邻也算)
解题思路:固定只要2层,每层都是n*n个格子,第一层每行都为国家的枚举,第二层每列都为国家的枚举,这样国家与国家间肯定会有相邻点
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n;
while(cin >> n && n) {
cout << 2 << " " << n << " " << n << endl;
for(int i = 0; i < n; i++) {
char ch;
if(i < 26) {
ch = 'a' + i;
}
else {
ch = 'A' + i - 26;
}
for(int j = 0; j < n; j++) {
cout << ch;
}
cout << endl;
}
cout << endl;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
char ch;
if(j < 26) {
ch = 'a' + j;
}
else {
ch = 'A' + j - 26;
}
cout << ch;
}
cout << endl;
}
cout << endl;
}
return 0;
}