백준 [ALGORITHM] - 안녕 (1535)
2024. 5. 19. 17:58ㆍ코딩/백준 [ALGORITHM]
반응형
def dp(health, enjoy):
health = list(map(int, health))
enjoy = list(map(int, enjoy))
dp = [0] * 101
for h, e in zip(health, enjoy):
if h >= 100:
continue
for i in range(99, h - 1, -1):
dp[i] = max(dp[i], dp[i - h] + e)
print(max(dp))
n = int(input())
health = input().split()
enjoy = input().split()
dp(health, enjoy)
반응형
'코딩 > 백준 [ALGORITHM]' 카테고리의 다른 글
백준 [ALGORITHM] - 그룹 단어 체커 (1316) (0) | 2024.06.02 |
---|---|
백준 [ALGORITHM] - 최댓값 (2566) (0) | 2024.05.23 |
백준 [ALGORITHM] - 사이클 단어 (1544) (0) | 2024.05.17 |
백준 [ALGORITHM] - 학생 번호 (1235) (0) | 2024.05.15 |
백준 [ALGORITHM] - 별 찍기 - 7 (2444) (0) | 2024.04.29 |