Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140659 刘梓含 19众数 C++ Compile Error 0 MS 0 KB 455 2025-12-18 19:54:30

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { int n,b[s],s = 1001; cin >> n; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; } for(int i = 1; i < s; i++) { b[i] = 0; } for(int i = 0; i < n; i++) { int d = a[i]; b[d] = b[d] + 1; } int m = 1; for(int i = 2; i < s; i++) { if (b[i] > b[m]) { m = i; } } cout << m; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:11: error: 's' was not declared in this scope
   int n,b[s],s = 1001; 
           ^
Main.cc:13:4: error: 'b' was not declared in this scope
    b[i] = 0; 
    ^
Main.cc:18:4: error: 'b' was not declared in this scope
    b[d] = b[d] + 1;
    ^
Main.cc:23:8: error: 'b' was not declared in this scope
    if (b[i] > b[m]) 
        ^