tj
2025-03-23 12:37:21
发布于:上海
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
void h(){
int a,b=1;
cin>>a;
for(int i=1;i<=a;i++){
if(i%2==1){
for(int j=1;j<=a;j++,b++) cout<<b<<' ';
b+=a-1;
}else{
for(int j=a;j>=1;j--,b--) cout<<b<<' ';
b+=a+1;
}
cout<<'\n';
}
}
int main(){
h();
}
这里空空如也
有帮助,赞一个