Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
116080 李朋秦 19选班长 C++ Compile Error 0 MS 0 KB 330 2025-04-06 10:19:07

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n,a,b[100]={}max=0;anx=0; cin>>n; for(int i=1;i<3*n;i++) { cin>>a; b[a]++; } for(int i=1;i<=n;i++) { if(b[i]>max) { max=b[i]; ans=i; } } cout<<ans<<"号学生得票最高,为"<<max<<"票"<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:22: error: expected ',' or ';' before 'max'
     int n,a,b[100]={}max=0;anx=0;
                      ^
Main.cc:5:28: error: 'anx' was not declared in this scope
     int n,a,b[100]={}max=0;anx=0;
                            ^
Main.cc:14:11: error: invalid operands of types 'int' and '' to binary 'operator>'
   if(b[i]>max)
           ^
Main.cc:16:7: error: overloaded function with no contextual type information
    max=b[i];
       ^
Main.cc:17:4: error: 'ans' was not declared in this scope
    ans=i;
    ^
Main.cc:20:8: error: 'ans' was not declared in this scope
  cout<