Dollar Dayz POJ - 3181

解法

完全背包+大数。。。不想写大数了放个python得了

代码

dp=[0 for i in range(2000)]
n,k=map(int,input().split())
num=[i for i in range(1,k+1)]
dp[0]=1
for i in range(k):
    for j in range(num[i],n+1):
        dp[j]+=dp[j-num[i]]
print(dp[n])
posted @ 2019-01-08 20:10  baccano!  阅读(90)  评论(0编辑  收藏  举报