Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95916 | 夏梓瑞 | 蛇形矩阵 | C++ | Wrong Answer | 1 MS | 264 KB | 591 | 2024-11-02 14:45:47 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n; cin>>n; int a[n+1][n+1],f=1; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ a[j][i]=f; f++; } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<a[i][j]<<' '; }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 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16