2024년 01월 08일
https://www.acmicpc.net/problem/1434
1434번: 책 정리
첫째 줄에 박스의 개수 N, 책의 개수 M이 주어진다. 둘째 줄에는 박스의 용량 A1, A2, ..., AN이 주어지고, 셋째 줄에는 B1, B2, ..., BM이 주어진다.
www.acmicpc.net
내 풀이
31120kb 44ms
box, book = map(int,input().split())
box_list = list(map(int,input().split()))
book_list = list(map(int,input().split()))
for weight in book_list:
i = 0
while True:
if box_list[i] < weight:
i += 1
pass
else: # box_list[i] >= weight
box_list[i] -= weight
break
answer = 0
for i in box_list:
answer+= i
print(answer)
'파이썬 알고리즘 연습' 카테고리의 다른 글
[백준 1453번] 피시방 알바 (0) | 2024.01.17 |
---|---|
[백준 1440번] 타임머신 (0) | 2024.01.17 |
[백준 1408번] 24 (0) | 2024.01.17 |
[백준 1392번] 노래 악보 (0) | 2024.01.17 |
[백준 1371번] 가장 많은 글자 (0) | 2024.01.16 |