51nod 1011 【完全背包】
来源:互联网 发布:弓箭在淘宝上买几元 编辑:程序博客网 时间:2024/06/07 11:30
完全背包的变形;
这些数字可以取多次,dp[i]代表前 i 物品组成N时的方案数。
#include<iostream>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<map>#include<vector>#include<queue>using namespace std;typedef long long LL;const int mod=1e9+7;int w[13]={1,2,5,10,20,50,100,200,500,1000,2000,5000,10000};LL dp[100010];void init(){ dp[0]=1; for(int i=0;i<13;i++) { for(int j=w[i];j<=100000;j++) { if(dp[j-w[i]]) dp[j]=(dp[j]+dp[j-w[i]])%mod; } }}int main(){ init(); int n; scanf("%d",&n); printf("%lld\n",dp[n]); return 0;}
0 0
- 51nod 1011 【完全背包】
- 51nod 1101 完全背包
- 51nod 1101 换零钱 (完全背包)
- 51nod 1101 换零钱 完全背包
- 01背包及完全背包问题(51Nod
- 【51Nod】1101 - 换零钱(完全背包)
- 51nod oj 1101 换零钱【完全背包】
- 51nod 1101 换零钱 完全背包计数
- 51nod--多重背包
- 51Nod - 1101 背包
- 背包问题-----51Nod
- 51nod 1101 换零钱 完全背包的变型 动态规划
- 51nod-1086 背包问题(多重背包)
- 51nod 1085 背包问题【01背包】
- 51nod 1085 背包问题【01背包】
- 51nod-1085 背包问题【01背包】
- 51nod 1085 背包问题
- 51nod多重背包问题
- 2016.10.29noip模拟总结
- C语言开发邮件系统-1
- Java到底有没有引用传递?
- 共享内存实现原理
- Matlab Tricks(十七)—— 使用 Latex
- 51nod 1011 【完全背包】
- 动态库与静态库
- el表达式
- 为什么RTP往往是使用UDP,而不是使用TCP封装
- TI C6000优化手册——让代码看起来像钉子
- git commit 遇到error: pathspec
- 2的N次方 用数组
- 归并排序
- Android Studio常用断点调试功能