Building for UN
题意:建一座多层矩形大厦,安排n个国家进入其中的房间(一个国家可以多个房间),使得n个国家两两之间相邻
解法:直接分两层,n*n的矩阵,一个打竖安排,一个打横安排即可
#include <iostream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
char c[100];
int n;
int main() {
freopen("building.in","r",stdin);
freopen("building.out","w",stdout);
for (int i = 1; i <= 26; i++)
c[i] = 'A'+i-1;
for (int i = 1; i <= 26; i++)
c[i+26] = 'a'+i-1;
cin >> n;
cout << 2 << " " << n << " " << n << endl;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) cout << c[i];
cout << endl;
}
cout << endl;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) cout << c[j];
cout << endl;
}
fclose(stdin);fclose(stdout);
}