| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 3649 | 匿名用户 | 蛇形矩阵 | C++ | Accepted | 100 | 0 MS | 248 KB | 515 | 2019-12-20 22:24:04 |
#include<iostream> using namespace std; int main(){ int n; cin>>n; int m[n+1][n+1]; int a=1; for(int i=1;i<=n;i++){ if(i%2==0){ for(int j=n;j>=1;j--){ m[i][j]=a; a++; } }else{ for(int j=1;j<=n;j++){ m[i][j]=a; a++; } } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<m[i][j]<<" "; } cout<<endl; } return 0; }