#include<bits/stdc++.h> using namespace std; int n,i,j; int kkk(int c,int x,int y){ if(x==1){ return y; }else if(y==c){ return c+x-1; }else if(x==c){ return c+c-1+c-y; }else if(y==1){ return 4*c-2-x; }else return 4*(c-1)+kkk(c-2,x-1,y-1); } int main(){ cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<setw(3)<<kkk(n,i,j)<<" "; } cout<<endl; } return 0; } /************************************************************** Problem: 1208 User: chenyubo Language: C++ Result: Presentation Error ****************************************************************/