코딩테스트

[python] 백준 30802번 : 웰컴 키트

Alpaca_data_cloud 2024. 7. 9. 15:55

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

n : 전체 인원 수

shirts : 각 사이즈 별 인원 수 리스트

t , p : 티셔츠 와 펜의 한 묶음의 갯수

티셔츠의 경우는 남아도 되지만 모자르면 안되므로 묶음 수로 나누었을 때 나머지가 나오면 한 묶음을 더해주어야 한다.

펜의 경우는 몪과 나머지를 각각 출력해주면 된다.

n = int(input())
shirts = list(map(int,input().split()))
t , p = map(int,input().split())

maxt = maxp = pen = 0
for shirt in shirts:
    if shirt % t > 0:
        temp = (shirt//t) + 1
    else:
        temp = (shirt//t)

    maxt += temp
    
maxp = n // p
pen = n % p

print(maxt)
print(maxp,pen)