반응형
문제 설명
제출한 코드
n, m = map(int, input().split())
book = 0
box = 0
if n != 0 :
lst = list(map(int, input().split()))
box += 1
for i in range(n) :
book += lst[i]
if book > m :
book = lst[i]
box += 1
print(box)
결과
후기
예제를 보면 알 수 있겠지만, 책을 정리해서 넣는 게 아니라 입력한 순서대로 넣는 것이다. 지문 수정 요청은 이미 있길래 따로 넣지는 않았다.
반응형
'BQJ 백준 > python' 카테고리의 다른 글
[Python/파이썬] 백준 2750번: 수 정렬하기 (0) | 2024.07.09 |
---|---|
[Python/파이썬] 백준 1978번: 소수 찾기 (0) | 2024.07.09 |
[Python/파이썬] 백준 2747번: 피보나치 수 (0) | 2024.07.07 |
[Python/파이썬] 백준 2744번: 대소문자 바꾸기 (0) | 2024.07.07 |
[Python/파이썬] 백준 2743번: 단어 길이 재기 (0) | 2024.07.07 |