백준 2579 - 계단오르기_DP


백준 2579 - 계단오르기_DP

1234567891011121314n = int(input())score = [0]*300for i in range(n): score[i] = int(input())dp = [0]*300dp[0] = score[0]dp[1] = score[0]+score[1]dp[2] = max(score[0]+score[2],score[1]+score[2]) for i in range(3,n): dp[i] = max(dp[i-2]+score[i],dp[i-3]+score[i]+score[i-1]) print(dp[n-1]) Colored by Color Scriptercs...

백준 2579 - 계단오르기_DP에 대한 요약내용입니다.

자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.



원문링크 : 백준 2579 - 계단오르기_DP