| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 3698 | 老师 | 蛇形矩阵 | C++ | Accepted | 100 | 0 MS | 252 KB | 394 | 2019-12-21 10:26:15 |
#include<iostream> using namespace std; int main(){ int n,a[11][11],k=1; cin>>n; for(int i=1;i<=n;i++){ if(i%2==1){ for(int j=1;j<=n;j++){ a[i][j]=k++; } }else{ for(int j=n;j>=1;j--){ a[i][j]=k++; } } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<a[i][j]; if(j!=n) cout<<" "; } if(i!=n) cout<<endl; } return 0; }