BOJ - 11652 - 카드

Updated:

import sys

def solution():
    N = int(sys.stdin.readline())
    dic = {}

    for i in range(N):
        num = int(sys.stdin.readline())
        if num in dic:
            dic[num] += 1
        else:
            dic[num] = 1

    dic = sorted(dic.items(), key=lambda x: (-x[1], x[0]))
    print(dic[0][0])

solution()

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

Categories:

Updated:

Leave a comment