cgy12306
[백준 BoJ] 11652 - 카드 본문
// https://www.acmicpc.net/problem/11652
// 카드
#include<iostream>
#include<unordered_map>
#include<vector>
#include<algorithm>
using namespace std;
long long num;
int N;
bool cmp(pair<long long, int> &a, pair<long long, int> &b) {
if (a.second == b.second) return a.first < b.first;
return a.second > b.second;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> N;
unordered_map<long long, int> um;
for (int i = 0; i < N; i++) {
cin >> num;
um[num]++;
}
vector<pair<long long, int>> V(um.begin(), um.end());
sort(V.begin(), V.end(), cmp);
cout << V[0].first;
}
'Algorithm > C++' 카테고리의 다른 글
[백준 BoJ] 11660 - 구간 합 구하기 5 (0) | 2022.01.14 |
---|---|
[백준 BoJ] 11659 - 구간 합 구하기 4 (0) | 2022.01.14 |
[백준 BoJ] 10825 - 국영수 (0) | 2022.01.13 |
[백준 BoJ] 17404 - RGB거리 2 (0) | 2022.01.13 |
[백준 BoJ] 1149 - RGB의 거리 (0) | 2022.01.12 |
Comments