#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<long long> number;
int cnt = 1, max = 1;
long long ans;
for (int i = 0; i < N; i++) {
long long num;
cin >> num;
number.push_back(num);
}
sort(number.begin(),number.end());
ans = number[0];
for (int i = 1; i < N; i++) {
if (number[i] == number[i-1]) {
cnt++;
if (max < cnt) {
max = cnt;
ans = number[i];
}
}
else cnt = 1;
}
cout << ans;
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 11718๋ฒ - ๊ทธ๋๋ก ์ถ๋ ฅํ๊ธฐ (0) | 2021.10.31 |
---|---|
[๋ฐฑ์ค,c++] 11659๋ฒ - ๊ตฌ๊ฐ ํฉ ๊ตฌํ๊ธฐ4 (0) | 2021.10.31 |
[๋ฐฑ์ค,c++] 11656๋ฒ - ์ ๋ฏธ์ฌ ๋ฐฐ์ด (0) | 2021.10.31 |
[๋ฐฑ์ค,c++] 11651๋ฒ - ์ขํ ์ ๋ ฌํ๊ธฐ2 (0) | 2021.10.28 |
[๋ฐฑ์ค,c++] 11650๋ฒ - ์ขํ ์ ๋ ฌํ๊ธฐ (0) | 2021.10.28 |
[๋ฐฑ์ค,c++] 1159๋ฒ - ๋๊ตฌ ๊ฒฝ๊ธฐ (0) | 2021.10.28 |
๋๊ธ