[luoguP1474] 货币系统 Money Systems(背包)
2017-06-20 15:18
183 查看
背包
——代码
#include <cstdio> #include <iostream> #define LL long long int v, n; LL f[10001]; inline int read() { int x = 0, f = 1; char ch = getchar(); for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -1; for(; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0'; return x * f; } int main() { int i, j, x; v = read(); n = read(); f[0] = 1; for(i = 1; i <= v; i++) { x = read(); for(j = x; j <= n; j++) f[j] += f[j - x]; } printf("%lld\n", f ); return 0; }
相关文章推荐
- 洛谷1474 货币系统
- 120.货币系统(完全背包的方案数目)
- 背包问题的方案总数 P1474 货币系统
- ACM 698. 货币系统(背包变形)
- P1474 货币系统 Money Systems
- P1474 货币系统 Money Systems
- 货币系统(money) 背包问题
- USACO 2.3 货币系统(背包/生成函数)
- [USACO 2.3.4]货币系统【DP完全背包的简单应用】CSUST 1081
- [USACO2.3]货币系统 Money Systems
- USACO 2.3 货币系统(背包/生成函数)
- 洛谷1474 货币系统
- 夕拾算法进阶篇:20)货币系统 (完全背包_动态规划DP)
- (ssl1115)USACO 2.3 货币系统(背包/生成函数)(背包的方案总数)
- 算法竞赛宝典 动态规划 货币系统问题(完全背包+一维优化)
- 【DP】洛谷 P1474 货币系统 Money Systems
- 货币系统(背包)
- USACO 2.3 货币系统(背包/生成函数)
- [USACO 2.3.4]货币系统【DP完全背包的简单应用】CSUST 1081
- 背包问题练习之货币系统