본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 29991번 Fatigue-Fighting Vacation

by 현장 2025. 4. 14.

-Code

from sys import stdin
input = stdin.readline

d, c, r = map(int, input().split())
c_list = [int(input()) for _ in range(c)]
r_list = [int(input()) for _ in range(r)]
d += sum(r_list)
res = r
idx = 0

for cost in c_list:
    if d >= cost:
        d -= cost
        res += 1
    else:
        break

print(res)