Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157199 余建成 蛇形矩阵 C++ Compile Error 0 MS 0 KB 355 2026-07-20 14:34:18

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int i,a[11][11]={},n,m=1,c=0; cin>>n; for(i=0;i<n;i++){ if(i%2==1){ for(int j=n-1;j>=0;j--) a[j][i]=m++; } else{ for(int j=0;j<n;j++) a[j][i]=m++; } } for(i=0;i<n;i++){ for(int j=0;j<n;j++){ print("%3d",a[i][j]); } cout<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:18:23: error: 'print' was not declared in this scope
    print("%3d",a[i][j]);
                       ^
Main.cc:4:27: warning: unused variable 'c' [-Wunused-variable]
  int i,a[11][11]={},n,m=1,c=0;
                           ^