uva_357Let Me Count The Ways
来源:互联网 发布:交易师软件下载 编辑:程序博客网 时间:2024/05/18 18:00
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define COIN 5#define MAXN 30000+10unsigned long long dp[MAXN];int coin[] = {1, 5, 10, 25, 50};void complete_knapsack(void){ memset(dp, 0, sizeof(dp)); dp[0] = 1; for(int i = 0; i < COIN; i ++) { for(int j = 1; j < MAXN; j ++) { if( j < coin[i] ) { continue; } dp[j] += dp[j-coin[i]]; } }}int main(int argc, char const *argv[]){#ifndef ONLINE_JUDGE freopen("test.in", "r", stdin);#endif int n; complete_knapsack(); while( ~scanf("%d", &n) ) { if( 1 == dp[n] ) { printf("There is only 1 way to produce %d cents change.\n", n); } else { printf("There are %llu ways to produce %d cents change.\n", dp[n], n); } } return 0;}
- uva_357Let Me Count The Ways
- Let Me Count The Ways
- Let Me Count The Ways
- 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
- 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
- UVa 357: Let Me Count The Ways
- 范特西的伤感空间日志推荐:我在风中颤抖,你却再难回头
- oracle中批量杀session
- Window.ShowModalDialog的参数问题
- 纹理分类(一)全局特征
- (BFS)2251 Dungeon Master
- uva_357Let Me Count The Ways
- 那么多的悲伤,只有自己能承担:冷小兮情感日志分享
- GDI+学习记录(16)-字体Font
- 拷贝构造函数调用父类的构造函数
- 关于 非文件所有者 使用cp命令后 文件权限的问题
- 乘法口诀表
- IOS数据的存储和读取之文件操作
- 虚拟机安装Mac Ox 10.6 之后的驱动安装vmware tool 安装
- 我会安静的忘记你:伤感爱情空间日志