#include<iostream>
#include<map>
using namespace std;
int main()
{
map<int, int> m; // map<key,value>
int n,v;
// 输入数据,构建map
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> v;
m[v]++;
}
// 找出次数出现最多的数
int ans, count = 0;
for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
if (it->second > count) {
count = it->second;
ans = it->first;
}
cout << ans << endl;
system("pause");
return 0;
}
CCF 201312-1 出现次数最多的数(满分)
猜你喜欢
转载自blog.csdn.net/qq_27538633/article/details/105803046
今日推荐
周排行