| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 83786 | 游四鑫 | 蛇形矩阵 | C++ | Wrong Answer | 1 MS | 276 KB | 428 | 2024-07-14 17:41:52 |
#include<iostream> using namespace std; int a[101][101]; int main(){ int n,w=0,k=1; cin>>n; for(int i=0;i<=n/2;i++){ for(int j=0;j<n;j++){ a[j][w]=k; k++; } w++; for(int j=n;j>=0;j--){ a[j][w]=k; k++; } w++; } for(int x=0;x<n;x++){ for(int y=0;y<n;y++){ cout<<a[x][y]<<' '; } cout<<endl; } return 0; }
------Input------
4
------Answer-----
1 8 9 16 2 7 10 15 3 6 11 14 4 5 12 13
------Your output-----
1 9 10 18 2 8 11 17 3 7 12 16 4 6 13 15