题意:一个联合国大楼每层都有数量相等大小相同的格子,将其分配给n个国家,使任意两个不同的国家都相邻(同层有公共边或相邻层的同一个格子)。

分析:可以设计一个只有两层的大楼,第一层每个国家占一行,第二层每个国家占一列,即每层都是n*n的。

#pragma comment(linker, "/STACK:102400000, 102400000")
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define Min(a, b) ((a < b) ? a : b)
#define Max(a, b) ((a < b) ? b : a)
typedef long long ll;
typedef unsigned long long llu;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const ll LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {, , -, , -, -, , };
const int dc[] = {-, , , , -, , -, };
const int MOD = 1e9 + ;
const double pi = acos(-1.0);
const double eps = 1e-;
const int MAXN = + ;
const int MAXT = + ;
using namespace std;
map<int, char> mp;
void init(){
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for(int i = ; i < ; ++i){
mp[i] = s[i];
}
}
int main(){
int n;
init();
bool flag = true;
while(scanf("%d", &n) == ){
if(flag) flag = false;
else printf("\n");
printf("2 %d %d\n", n, n);
for(int i = ; i < n; ++i){
for(int j = ; j < n; ++j){
printf("%c", mp[i]);
}
printf("\n");
}
printf("\n");
for(int i = ; i < n; ++i){
for(int j = ; j < n; ++j){
printf("%c", mp[j]);
}
printf("\n");
}
}
return ;
}
05-12 09:05