Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
132899 杨登博 蛇形矩阵 C++ Wrong Answer 2 MS 268 KB 656 2025-10-12 16:00:41

Tests(0/10):


Code:

#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,a[11][11],k=1; cin>>n; for(int i=1;i<=n;i++){ if(i%2==0){ for(int j=n;j>=1;j--){ a[j][i]=k++; cout<<a[j][i]<<" "<<endl; } } else{ for(int j=1;j<=n;j++){ a[j][i]=k++; cout<<a[j][i]<<" "<<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 5 6 7 8 9 10 11 12 13 14 15 16