Run ID:164959
提交时间:2026-11-08 13:56:43
#include<bits/stdc++.h> 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; }