The result of this question is very good, and the thinking ability is examined. On the second layer, each layer has n * n grids. the first layer of line I is placed in country I, and the second layer of column J is placed in country J.
Note that in ASCII, A to Z is in front of A to Z (the numbers are small), and they are not in the two groups. Therefore, the char C (int I) function is required.
#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<map>#include<set>#include<vector>#include<algorithm>#include<stack>#include<queue>#include<cctype>#include<sstream>using namespace std;#define INF 1000000000#define eps 1e-8#define pii pair<int,int>#define LL long long int#define maxn 100010int n;char c(int i){ if(i<26) return ‘A‘+i; else return ‘a‘+i-26;}int main(){ //freopen("in8.txt","r",stdin); //freopen("out.txt","w",stdout); int t=0; while(~scanf("%d",&n)) { if(t) { printf("\n"); } else t=1; printf("2 %d %d\n",n,n); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { printf("%c",c(i)); } printf("\n"); } printf("\n"); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { printf("%c",c(j)); } printf("\n"); } } //fclose(stdin); //fclose(stdout); return 0;}
Uva1605-building for UN (constructor)