Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
139257 李俊博 蛇形矩阵 C++ Wrong Answer 0 MS 272 KB 393 2025-12-06 11:14:55

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n+1][n+1]; for(int i=1;i<=n;i++){ int s; if(i%2==1){ s=(i-1)*n+1; for(int j=1;j<=n;j++){ cout<<s; s++; cout<<" "; } }else{ s=i*n; for(int j=1;j<=n;j++){ cout<<s; s--; cout<<" "; } } cout<<endl; } return 0; }


Run Info:

------Input------
4
------Answer-----
1 8 9 16 2 7 10 15 3 6 11 14 4 5 12 13
------Your output-----
1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13