본문으로 건너뛰기

BOJ 13300

13300 방 배정

Clicking the heading will take you to the BOJ problem.

Solution

문제에서 입력으로 받는 숫자를 잘 쓰자. 이차원 배열도 잘 쓰자.

n, k = map(int, input().split())
room = [[0] * 7 for _ in range(2)]

for _ in range(n):
    s, y = map(int, input().split())
    room[s][y] += 1

count = 0
for s in range(2):
    for y in range(1, 7):
        if room[s][y] > 0:
            count += (room[s][y] - 1) // k + 1 # math.ceil(n / k)
print(count)