Uva 147 Dollars 完全背包
2013-04-16 19:23
363 查看
题目链接:here
题意:和uva674差不多。。11种金币,输出能组成给定数额的方法个数
代码:
题意:和uva674差不多。。11种金币,输出能组成给定数额的方法个数
代码:
#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int maxn = 30010/5; int coin[11] = {1,2,4,10,20,40,100,200,400,1000,2000}; long long dp[maxn]; int main() { int i, j; memset(dp, 0, sizeof(dp)); dp[0] = 1; for (i=0; i<11; i++) { for (j=coin[i]; j<=maxn; j++) { if (j >= coin[i]) dp[j] += dp[j-coin[i]]; } } double n; while (scanf("%lf", &n) != EOF) { int tmp = (int)(20*n+0.5); if (tmp == 0) break; printf("%6.2lf%17lld\n", n, dp[tmp]); } return 0; }
相关文章推荐
- Uva 147 Dollars(是完全背包)
- uva 147 Dollars(完全背包)
- 【完全背包】UVA 147 Dollars
- UVa 147 Dollars(完全背包)
- UVA 147 Dollars(完全背包)
- Uva 147 Dollars 完全背包
- UVA 147 Dollars ( 完全背包+求解方案数精度问题)
- UVA - 147 Dollars (完全背包 入门题)
- UVA - 147 Dollars(完全背包)
- uva147 Dollars ——完全背包
- UVA 147 - Dollars(完全背包)
- uva 147 Dollars (dp + 完全背包)
- uva 147 Dollars(完全背包)
- uva 147 Dollars(完全背包)
- UVa 147 Dollars(DP完全背包)
- UVa 147 Dollars(DP完全背包)
- uva147 - Dollars(完全背包)
- UVA 147 Dollars (完全背包)
- UVA - 147 Dollars(完全背包)
- UVA 147 Dollars 完全背包 Commencel