UVA 357 Let Me Count The Ways 完全背包
来源:互联网 发布:汽车epc软件 编辑:程序博客网 时间:2024/05/29 07:22
又是重复问题,LRJ估计要突出这里基础的重要性,提交时忘了把freopen去掉。汗,反正乱刷UVA,WA就WA了
#include <map>#include <set>#include <list>#include <cmath>#include<cctype>#include <ctime>#include <deque>#include <stack>#include <queue>#include <cstdio>#include <string>#include <vector>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>#define LL long long#define PI 3.1415926535897932626using namespace std;int gcd(int a, int b){return a % b == 0 ? b : gcd(b, a % b);}LL dp[30080];int coin[]={1,5,10,25,50};int main(){ freopen("sample.txt","r",stdin); int n; dp[0]=1; for (int i=0;i<5;i++) for (int j=0;j<30004;j++) { dp[j+coin[i]]+=dp[j]; } while (scanf("%d",&n)!=EOF) { if (dp[n]==1)printf("There is only %lld way to produce %d cents change.\n",dp[n],n); else printf("There are %lld ways to produce %d cents change.\n",dp[n],n); } return 0;}
0 0
- UVA 357Let Me Count The Ways (dp + 完全背包)
- UVa 357 Let Me Count The Ways (完全背包)
- UVA 357 Let Me Count The Ways 完全背包
- UVA - 357Let 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(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
- 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
- Eclipse插件大全 挑选最牛的TOP30(全)
- Eclipse启动参数大全
- VC2010 CString.Format使用报错 error C2664
- Hadoop自学笔记(七)Hadoop环境配置和优化
- 祁县财政局与杨占全、程秋转、杨继明、程国俭、杨惠丽借款合同纠纷一审民事判决书
- UVA 357 Let Me Count The Ways 完全背包
- MAC OS 暗黑世界服务器端环境搭建(适合用MAC系统的亲们)
- zoj 3410 Layton's Escape(贪心+优先队列)
- Linux 学习之路(一)——Linux 发行版本的选择以及opensuse 13.1 安装
- FIFO存储深度(容量)计算
- C#对象克隆的战争
- javascript页面动态显示时间变化
- 修改论文格式的方法总结
- DOM4J 学习总结之 图示