UVA - 357 Let Me Count The Ways
2013-09-10 19:26
363 查看
题意:还是凑钱问题
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 30005; int money[5] = {1,5,10,25,50}; long long dp[MAXN]; int main(){ memset(dp,0,sizeof(dp)); dp[0] = 1; for (int i = 0; i < 5; i++) for (int j = money[i]; j < MAXN; j++) dp[j] += dp[j - money[i]]; int n; while (scanf("%d",&n) != EOF){ if (dp == 1) printf("There is only 1 way to produce %d cents change.\n",n); else printf("There are %lld ways to produce %d cents change.\n",dp ,n); } return 0; }
相关文章推荐
- UVa 357 - Let Me Count The Ways
- UVA - 357 Let Me Count The Ways
- UVa 357 - Let Me Count The Ways 背包
- uva 357 Let Me Count The Ways(01背包)
- UVa 357 - Let Me Count The Ways
- uva 357 - Let Me Count The Ways
- UVA 357 - Let Me Count The Ways
- UVa 357 - Let Me Count The Ways
- UVA 357 Let me count the ways
- uva357 Let Me Count The Ways
- UVa 357 - Let Me Count The Ways
- UVA 357 Let Me Count The Ways 动态规划解法、母函数解法
- UVa 357 Let Me Count The Ways
- uva 357 Let Me Count The Ways
- UVA 357 Let Me Count The Ways
- UVA 357 - Let Me Count The Ways
- UVA 357 Let Me Count The Ways (dp + 完全背包)
- UVa 357 - Let Me Count The Ways
- UVA-357-Let Me Count The Ways
- uva 357 - Let Me Count The Ways(动态规划-注意dp初始化的问题)