Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
123223 刘子锐 19选班长 C++ Compile Error 0 MS 0 KB 297 2025-06-28 13:34:10

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main( ){ int m; cin>>m; int b[m+1]; for(int i=0;i<m;i++){ cin>>a[i]; } int b[11]; for(int i=1;i<=10;i++){ b[i]=0; } for(int i=0;i<m;i++){ int x=a[i]; b[x]=b[x]+1; } for(int i=0;i<=10;i++){ cout<<b[i]<<" "; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:7: error: 'a' was not declared in this scope
  cin>>a[i];
       ^
Main.cc:10:9: error: conflicting declaration 'int b [11]'
 int b[11];
         ^
Main.cc:6:5: note: previous declaration as 'int b [(m + 1)]'
 int b[m+1]; 
     ^
Main.cc:15:8: error: 'a' was not declared in this scope
  int x=a[i];
        ^