| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148619 | Kevin | 蛇形矩阵 | C++ | Accepted | 0 MS | 272 KB | 429 | 2026-02-27 16:03:22 |
#include<bits/stdc++.h> using namespace std; int a[50][50]; int main() { int n,i=1,j=1; cin>>n; int s=1; while(s<=n*n){ while(j<=n){ while(i<=n){ a[i][j]=s; s++; i++; } i=n; j++; while(i>=1){ a[i][j]=s; s++; i--; } i=1; j++; } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<setw(3)<<a[i][j]; } cout<<endl; } return 0; }