Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141014 王丞杰 蛇形矩阵 C++ Wrong Answer 0 MS 272 KB 514 2025-12-20 16:48:29

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int a[11][11]; int main(){ int n,t=1; cin>>n; for(int j=0;j<n;j++){ if(j%2==1){ for(int i=0;i<n;i++){ a[i][j]=t; t++; } } else{ for(int i=n;i>0;i--){ a[i][j]=t; t++; } } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ printf("%3d ",a[i][j]); } printf("\n"); } 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-----
0 5 0 13 4 6 12 14 3 7 11 15 2 8 10 16