Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
107729 王煜鑫 19众数 C++ Compile Error 0 MS 0 KB 291 2025-01-18 11:39:27

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int a[100002]; int main() { int n,hao; cin>>n; for(int i=1;i<=n;i++){ cin>>hao; a[hao]++; } int max=0; for(int j=1;j<=1000;j++){ if(a[i]>max){ max=a[i]; id=i; } } cout<<id; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:13:8: error: 'i' was not declared in this scope
   if(a[i]>max){
        ^
Main.cc:15:4: error: 'id' was not declared in this scope
    id=i;
    ^
Main.cc:18:8: error: 'id' was not declared in this scope
  cout<