#include <cstring>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <unordered_map>
#include <map>
#define ll long long
using namespace std;
map<int, int>mp;
#define TLE ios::sync_with_stdio(0),cin.tie(0)
const int INF = 0x3f3f3f3f;
int main() {
TLE;
int n;
cin >> n;
int temp = 0, m = 0,m_t = 0;
for (int i = 0; i < n; i++) {
cin >> temp;
mp[temp]++;
if (mp[temp] > m) {
m = mp[temp];
m_t = temp;
}
if (mp[temp] == m && temp < m_t) {
m_t = temp;
}
}
cout << m_t << endl;
}
CCF 201312-1 出现次数最多的数
最新推荐文章于 2021-03-20 15:31:10 发布