Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157194 李沐阳 蛇形矩阵 C++ Presentation Error 2 MS 312 KB 374 2026-07-20 14:24:51

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,m=1,a[101][101]={}; cin>>n; for(int i=0;i<n;i++){ if(i%2==1){ for(int j=n-1;j>=0;j--){ a[j][i]=m++; } } else{ for(int j=0;j<n;j++){ a[j][i]=m++; } } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<a[i][j]<<' '; } cout<<endl; } return 0; }