Skip to content

Commit 02b1561

Browse files
committed
[BOJ] #17212. 달나라 토끼를 위한 구매대금 지불 도우미 / 실버3 / 39분 / 성공
1 parent 6ed1d77 commit 02b1561

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
N = int(input())
5+
dp = [0] * (N + 1)
6+
7+
# 1부터 7까지 최소 동전 개수 초기화
8+
dp[1:8] = [1, 1, 2, 2, 1, 2, 1]
9+
10+
for i in range(8, N+1):
11+
dp[i] = min(dp[i-1]+1, dp[i-2]+1, dp[i-5]+1, dp[i-7]+1)
12+
13+
print(dp[N])

0 commit comments

Comments
 (0)