Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141018 王丞杰 蛇形矩阵 C++ Presentation Error 0 MS 268 KB 519 2025-12-20 16:53:11

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=1;j<=n;j++){ if(j%2==1){ for(int i=1;i<=n;i++){ a[i][j]=t; t++; } } else{ for(int i=n;i>=1;i--){ a[i][j]=t; t++; } } } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ printf("%3d ",a[i][j]); } printf("\n"); } return 0; }