Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7190 詹梓涵 19众数 C++ Accepted 4 MS 260 KB 396 2025-04-05 15:35:10

Tests(10/10):


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]; if(i<z){ z=i; } } } cout<<z<<endl; return 0; }