BOJ - 4358 - 생태학

Updated:

import sys
from collections import defaultdict

def solution():
    N = 0
    dict = defaultdict(int)

    while True:
        data = sys.stdin.readline().strip()
        if not data:
            break

        dict[data] += 1
        N += 1

    retList = list(dict.keys())
    retList.sort()

    for t in retList:
        print('%s %.4f'%(t, dict[t]/N*100))

solution()

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

Categories:

Updated:

Leave a comment