Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154980 王安安 19众数 C++ Compile Error 0 MS 0 KB 247 2026-05-31 11:51:15

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,m=a[1],l=1;a[1001]={0}; cin>>n; int k; for(int i=1;i<=n;i++){ cin>>k; a[k]++; } for(int i=1;i<=1000;i++){ if(m<a[i]){ m=a[i]; l=i; } } cout<<l; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:10: error: 'a' was not declared in this scope
  int n,m=a[1],l=1;a[1001]={0};
          ^
Main.cc:14:4: error: 'l' was not declared in this scope
    l=i;
    ^
Main.cc:17:8: error: 'l' was not declared in this scope
  cout<