此题目直接用map标记次数即可,水题
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int main() {
//freopen("d:\\input.txt","r",stdin);
map<int,int> m;
int n,t,id=0,maxn=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&t);
if(m.count(t)==0)
m[t]=1;
else
m[t]++;
}
for(map<int,int>::iterator it=m.begin();it!=m.end();it++){
if(it->second>maxn){
id=it->first;
maxn=it->second;
}
//cout<<it->first<<" "<<it->second<<endl;
}
printf("%d\n",id);
return 0;
}