提交时间:2019-12-15 16:33:02

运行 ID: 3305

#include<iostream> using namespace std; int main(){ int y,er=1; cin>>y; int youku[y][y]; for(int E=1;E<=y;E++){ for(int r=1;r<=y;r++){ youku[E][r]=er; er++; } } for(int E=1;E<=y*y;E++){ youku[y][y]=E; } for(int t=1;t<=y;t++){ for(int u=1;u<=y;u++){ cout<<youku[t][u]; er++; if(u!=y) cout<<" "; } cout<<endl; } return 0; }