본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#360 백준 파이썬 [13300] 방 배정

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

 

PYTHON CODE

import math

N, K = map(int, input().split())
student = [[0] * 7 for _ in range(3)] #성별 / 학년별

for _ in range(N):
    S, Y = map(int, input().split())
    student[S][Y] += 1
        
room = 0
for i in student:
    for j in i:
        room += math.ceil(j / K)
print(room)