Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
3609 倪邢暄 蛇形矩阵 C++ Accepted 100 1 MS 252 KB 377 2019-12-20 20:53:00

Tests(4/4):


#include<iostream> using namespace std; int main(){ int a[11][11]={0}; int n,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]<<" "; } cout<<endl; } return 0; }


Judgement Protocol: