Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7252 邓小龙 19众数 C++ Compile Error 0 MS 0 KB 368 2025-04-11 15:16:22

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[1001]={},n,t,m=0,b=0,z=1001; cin>>n; for(int i=1;i<=n;i++){ cin>>t; a[t]++; b=max(b,t); } for(int i=b;i>=1;i--){ if(a[i]>=m){ m=a[i]; z=i; } } } cout<<z<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:32: warning: variable 'z' set but not used [-Wunused-but-set-variable]
     int a[1001]={},n,t,m=0,b=0,z=1001;
                                ^
Main.cc: At global scope:
Main.cc:18:5: error: 'cout' does not name a type
     cout<z<<endl;
     ^
Main.cc:19:5: error: expected unqualified-id before 'return'
     return 0;
     ^
Main.cc:20:1: error: expected declaration before '}' token
 }
 ^