BOJ - 2293 - 동전 1

Updated:

def solution():
    coin = []
    N, K = map(int, input().split(' '))
    coin.append(0)
    for _ in range(N):
        coin.append(int(input()))

    dp = [0] * 10001
    dp[0] = 1

    for i in range(1, N+1):
        for j in range(1, K+1):
            if j >= coin[i]:
                dp[j] += dp[j-coin[i]]

    print(dp[K])

solution()

https://www.acmicpc.net/problem/2293

Categories:

Updated:

Leave a comment