BOJ - 14649 - 문홍안

Updated:

import sys

def solution():
    P = int(sys.stdin.readline())
    N = int(sys.stdin.readline())

    arr = [0 for _ in range(100)]

    for _ in range(N):
        index, dist = map(str, sys.stdin.readline().split())
        index = int(index)
        if dist == 'R':
            for i in range(index, 100):
                arr[i] += 1
        else:
            for i in range(index - 2, -1, -1):
                arr[i] += 1

    ret = [0] * 3
    for i in range(100):
        if arr[i] % 3 == 0:
            ret[0] += 1
        elif arr[i] % 3 == 1:
            ret[1] += 1
        elif arr[i] % 3 == 2:
            ret[2] += 1

    print("%0.2f\n%0.2f\n%0.2f"%(P / 100 * ret[0], P / 100 * ret[1], P / 100 * ret[2]))

solution()

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

Categories:

Updated:

Leave a comment