-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ11652_카드.cpp
More file actions
41 lines (36 loc) · 774 Bytes
/
BOJ11652_카드.cpp
File metadata and controls
41 lines (36 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// main.cpp
// BOJ11652_카드
//
// Created by 신지식 on 03/12/2018.
// Copyright © 2018 Shin Ji Sik. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main(int argc, const char * argv[]) {
ios::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
int n;
cin >> n;
map<long long, int> m;
long long num;
for(int i = 0; i < n; i++){
cin >> num;
m[num] += 1;
}
long long ans = 0;
long long dif = 0;
for(auto &k : m){
if(k.second > dif){
dif = k.second;
ans = k.first;
}
else if(dif == k.second && ans > k.first){
ans = k.first;
}
}
cout << ans << "\n";
}