Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
148962 李亭绪 19众数 C++ Accepted 4 MS 276 KB 539 2026-03-04 19:47:24

Tests(11/11):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[1001]={},n,x,max=-1,max_i; cin>>n; for(int i=1;i<=n;i++){ cin>>x; a[x]++; } for(int i=1;i<=1000;i++) { if(a[i]>max) { max=a[i]; max_i=i; } } cout<<max_i; return 0; }