Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154964 刘杨国卿 19众数 C++ Accepted 10 MS 1056 KB 277 2026-05-31 11:46:18

Tests(11/11):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n; long long a[100001]={0}; for(int i=1;i<=n;i++){ cin>>k; a[k]++; } int m=a[1],x=1; for(int i=1;i<=1000;i++){ if(a[i]>m){ m=a[i]; x=i; } } cout<<x; return 0; }