백준 15155번: Analysis of Advanced Analytics #Python

ColorlessDia·2026년 3월 2일

algorithm/baekjoon

목록 보기
835/836
N, K = map(int, input().split())
P_list = list(map(int, input().split()))

k = K
count = 1

for P in P_list:

    if P <= k:
        k -= P
    else:
        k = K - P
        count += 1

print(count)

0개의 댓글