Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
3752 宋铭扬 蛇形矩阵 C++ Compile Error 0 0 MS 0 KB 431 2019-12-21 19:02:00

Tests(0/0):


#include<iostream> using namespace std; int main() { int n,now=0; int a[11][11]; cin>>n; for(int i=1;i<=n;i++) { if(i%2==1) for(int j=1;j<=n;j++) { a[i][j]=now; now++; } } if(i%2==0) { for(int j=n;j>=1;j--) { a[i][j]=now; now++; } } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { cout<<a[i][j]<<" "; } cout<<endl; } return 0; }


Judgement Protocol: