[BOJ] 방 배정

Date:

[BOJ] 방 배정

Problem URL : 방 배정

N, K = map(int, input().split())

student = [[0, 0] for _ in range(6)]
for i in range(N):
    sex, grade = map(int, input().split())
    grade -= 1
    student[grade][sex] += 1

ans = 0
for i in range(6):
    ans += (student[i][0] + K - 1) // K
    ans += (student[i][1] + K - 1) // K

print(ans)

Comments

올림을 K - 1을 더해주어서 처리하였다.

댓글