Skip to content

Latest commit

Β 

History

History
17 lines (12 loc) Β· 570 Bytes

README.md

File metadata and controls

17 lines (12 loc) Β· 570 Bytes

[baekjoon-2156] 포도주 μ‹œμ‹

image

IMG_31725EF2855A-1

점화식

dp λ°°μ—΄ : μ§€κΈˆκ» μ„ νƒν•œ 것듀 쀑 μ΅œλŒ€μ˜ κ°’ (연속 3개 선택 x)

dp[1] = drink[1]
dp[2] = drink[1] + drink[2]
...
dp[n] = Math.max(dp[n-2] + drink[n], drink[n-3] + drink[n-1] + drink[n])
dp[n] = Math.max(dp[n-1], dp[n]) /* 연속 2개 선택 x */