https://www.acmicpc.net/problem/11052
import sys
input = sys.stdin.readline
N = int(input())
price = list(map(int, input().split(" ")))
# 계산하기 편하도록 인덱스 1~N으로 설정
price.insert(0, 0)
dp = [0]*(N+1)
for i in range(1, N+1):
for j in range(1, i+1):
dp[i] = max(dp[i], price[j] + dp[i-j])
print(dp[N])'코딩테스트 > 코딩테스트 문제풀이' 카테고리의 다른 글
| [Python] 백준 <1946-신입 사원> (0) | 2025.07.07 |
|---|---|
| [Python] 백준 <2589-보물섬> (0) | 2025.07.07 |
| [Python] 백준 <3020-개똥벌레> (0) | 2025.06.29 |
| [Python] 백준 <11497-통나무 건너뛰기> (0) | 2025.06.26 |
| [Python] 백준 <7576-토마토> (0) | 2025.06.26 |