페이지

11652번: 카드

https://www.acmicpc.net/problem/11652


$O(nlgn)$


#include<cstdio>
#include<map>
using namespace std;
int n, c;
long long x, r;
map<long longint> mp;
int main() {
    for (scanf("%d", &n); n--;) scanf("%lld", &x), mp[x]++;
    for (auto &it : mp) if (it.second > c) r = it.first, c = it.second;
    printf("%lld", r);
    return 0;
}

댓글 없음 :

댓글 쓰기