백준 30802 파이썬

seongbin·2024년 7월 16일

쉽게 풀 수 있을 것 같았는데 생각보다 많이 틀린 문제이다,,
구글에 파이썬 풀이가 안나와서 직접 써보기로 했다

틀린 이유는 특정 사이즈의 티셔츠를 신청한 사람이 0명일 수도 있다는 것,,
위만 알고 있으면 쉽게 풀 수 있을 것 같다

n=int(input())
lst=list(map(int,input().split()))
t,p = map(int,input().split())
t_bundle=0

for i in lst:
    if i==0:
        continue
    elif i<=t:
        t_bundle+=1
    elif i%t==0:
        t_bundle+=i//t
    else:
        t_bundle+=i//t+1

p_bundle=n//p
pen=n%p

print(t_bundle)
print(f'{p_bundle} {pen}')

0개의 댓글