货币系统(背包)
2018-03-07 22:17
169 查看
货币系统
Problem Description
给你一个n种面值的货币系统,求组成面值为m的货币有多少种方案。
Input
输入有多组数据,每组数据第一行:n,m的值,后面n行为每种货币的面值。
Output
对于每组数据输出组成面值为m的货币的方案数。
Sample Input
3 10 1 2 5
Sample Output
10#include<bits/stdc++.h>
using namespace std;
int v,n,p,i,j;
int f[1001];
int main()
{
cin >> v >> n;
f[0] = 1;
for(i = 1;i <= v;i ++){
cin >> p;
for(j = p;j <= n;j ++)
f[j] += f[j-p];
}
cout << f
;
return 0;
}
相关文章推荐
- [USACO 2.3.4]货币系统【DP完全背包的简单应用】CSUST 1081
- USACO 2.3 货币系统(背包/生成函数)
- [USACO 2.3.4]货币系统【DP完全背包的简单应用】CSUST 1081
- 背包问题练习之货币系统
- USACO 2.3 货币系统(背包/生成函数)
- 算法竞赛宝典 动态规划 货币系统问题(完全背包+一维优化)
- 背包问题的方案总数 P1474 货币系统
- [luoguP1474] 货币系统 Money Systems(背包)
- ACM 698. 货币系统(背包变形)
- (ssl1115)USACO 2.3 货币系统(背包/生成函数)(背包的方案总数)
- 120.货币系统(完全背包的方案数目)
- USACO 2.3 货币系统(背包/生成函数)
- 夕拾算法进阶篇:20)货币系统 (完全背包_动态规划DP)
- USACO 2.3 货币系统(背包/生成函数)
- 货币系统(money) 背包问题
- 云风开发笔记(1) 背包系统
- Unity背包系统(二)背包UI设计
- 基于以太坊系统的货币系统(一)
- UGUI--背包系统之三--------Slot
- siki背包系统(1) 详细笔记