#include #include #include using namespace std; void SetValue(vector> &A,int stX,int stY,int W,int &V) { int i,j; //上行 i=stX; j=stY; while (j=stY){ A[i][j--]=V++; } //左列 j++; i--; while (i>stX){ A[i--][j]=V++; } } int main(int argc, char* argv[]) { int N; cin>>N; vector> A(N,vector(N)); int V=1; int stX=0; int stY=0; int W=N; while(true){ SetValue(A,stX,stY,W,V); stX++; stY++; W-=2; if (W<=0){ break; } } int i,j; for (i=0;i