Run ID:20848

提交时间:2021-12-12 19:08:14

#include<iostream> using namespace std; int main(){ int a[11][11],b,c=1; cin>>b; for(int i=0;i<b;i++){ if(i%2==1){ for(int j=b-1;j>=0;j--){ a[i][j]=c; c++; } } else{ for(int j=0;j<b;j++){ a[i][j]=c; c++; } } } for(int i=0;i<b;i++){ for(int j=0;j<b;j++){ cout<<a[i][j]<<' '; } cout<<endl; } return 0; }