#include <iostream> #include <fstream> #include <string> #include <cmath> using namespace std; const int maxn = 200; char seq[maxn] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; char print_seq[maxn][maxn]; int n; void f(int idx, int len, int x, int y){ if(idx == -1){ return ; } for(int dx = -(len); dx <= (len); dx += len ){ for(int dy = -(len); dy <= (len); dy += len){ int xx = x + dx; int yy = y + dy; print_seq[xx][yy] = seq[idx]; } } f(idx - 1, len + 1, x, y); } int main(){ // fstream cin("a.txt"); cin>>n; for(int i = 0; i < (2 * n - 1); ++i){ for(int j = 0; j < (2 * n - 1); ++j){ print_seq[i][j] = '.'; } } f(n - 2, 1, n - 1, n - 1); print_seq[n - 1][n - 1] = seq[n - 1]; for(int i = 0; i < (2 * n - 1); ++i){ for(int j = 0; j < (2 * n - 1); ++j){ cout<<print_seq[i][j]; } cout<<endl; } return 0; } /************************************************************** Problem: 1856 User: admin Language: C++ Result: Accepted Time:51 ms Memory:2116 kb ****************************************************************/