hdu 2069 1 5 10 25 50 这几种硬币 一共100个(母函数)
题意: 有50 25 10 5 1 的硬币 一共最多有100枚 输入n输出有多少种表示方法
Sample Input
11
26
Sample Output
4
13
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <string>
# include <cmath>
# include <queue>
# include <list>
# define LL long long
using namespace std ; int c1[][],c2[][];
int ans[] ;
int w[]={,,,,,}; void Init(){
memset(c1,,sizeof(c1));
memset(c2,,sizeof(c2));
c1[][]=;
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
for(int k=;j+k*w[i]<=;k++)
for(int p=;k+p<=;p++)
c2[j+k*w[i]][p+k]+=c1[j][p]; for(int j=;j<=;j++)
for(int p=;p<=;p++)
{
c1[j][p]=c2[j][p];
c2[j][p]=;
}
}
for(int i=;i<=;i++)
for(int j=;j<=;j++)
ans[i]+=c1[i][j]; //c1[11][3]表示这个方案 是用3枚硬币组成11的
ans[]=;
} int main()
{ int n;
Init();
while(~scanf("%d",&n))
{
printf("%d\n",ans[n]);
}
return ;
}
hdu 2069 1 5 10 25 50 这几种硬币 一共100个(母函数)的更多相关文章
- hdu 2069 限制个数的母函数(普通型)
Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- HDU 2069 Coin Change
Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total S ...
- 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command)
[源码下载] 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command) 作者:webabcd 介绍背水一战 Windows 10 之 MVV ...
- /proc/interrupts 统计2.6.38.8与3.10.25差异
eth4进,eth5出 linux-3.10.25 67: 2 3 2 3 PCI-MSI-edge eth468: ...
- CentOS安装NodeJS v0.10.25 + Express
安装必需组件 yum -y install gcc make gcc-c++ openssl-devel wget cd ~wget http://nodejs.org/dist/v0.10.25/n ...
- 10.25 正睿停课训练 Day9
目录 2018.10.25 正睿停课训练 Day9 A 数独(思路 DP) B 红绿灯(最短路Dijkstra) C 轰炸(计算几何 圆并) 考试代码 B C 2018.10.25 正睿停课训练 Da ...
- 题解报告:hdu 2069 Coin Change(暴力orDP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2069 Problem Description Suppose there are 5 types of ...
- Java习题10.25
Java习题10.25 1. 实际上这道题考查的是两同两小一大原则: 方法名相同,参数类型相同 子类返回类型小于等于父类方法返回类型, 子类抛出异常小于等于父类方法抛出异常, 子类访问权限大于等于父类 ...
- windows 10 超级优化,同时解决本地磁盘100%的问题
windows 10 超级优化,同时解决本地磁盘100%的问题 我的系统是笔记本I7处理器,配置了web服务器IIS 和一个数据库(mysql7),同时启用了虚拟机(表中已禁用),以及安装了offic ...
随机推荐
- php-fpm 重启 nginx单独配置 重启
nginx单独配置 重启 [root@ssy106c14c190c69 Api]# cd /usr/local/nginx/sbin/[root@ssy106c14c190c69 sbin]# lsn ...
- JS--数组和字典
一.JS数组 JavaScript中的数组类似于Python的列表 a = [11,22,33,44] 常见功能: obj.length 数组的大小 obj.push(ele) 尾部追加元素 obj ...
- servlet拦截器
servlet拦截未登录的用户请求 java代码: package com.gavin.filter; import java.io.IOException; import javax.servlet ...
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session异常解决办法
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread ...
- Nginx基础配置指令
nginx.conf文件的结构 ... #全局块 events{ #events块 ... } http{ #http块 ... #http全局块 server{ #server块 ... #serv ...
- bzoj千题计划156:bzoj1571: [Usaco2009 Open]滑雪课Ski
http://www.lydsy.com/JudgeOnline/problem.php?id=1571 DP不一定全部全状态转移 贪心的舍去一些不合法的反而更容易转移 在一定能力范围内,肯定滑雪所需 ...
- 穷竭搜索: POJ 2718 Smallest Difference
题目:http://poj.org/problem?id=2718 题意: 就是输入N组数据,一组数据为,类似 [1 4 5 6 8 9]这样在0~9之间升序输入的数据,然后从这些数据中切一 ...
- ICDM Winner's Interview: 3rd place, Roberto Diaz
ICDM Winner's Interview: 3rd place, Roberto Diaz This summer, the ICDM 2015 conference sponsored a c ...
- 把JS和CSS合并到1个文件
合并JS文件和CSS文件很多人都知道,也用过,目的是为了减少请求数.但有时候我们觉的把JS合并到1个文件,CSS又合并到另外1个文件也是浪费,我们如何能把CSS和JS一起合并进1个文件了? 这里需要使 ...
- 【前端】直击源头的让你3秒理解并且会用Jsonp!!!
1. 同源策略 ajax之所以需要“跨域”,罪魁祸首就是浏览器的同源策略.即,一个页面的ajax只能获取这个页面相同源或者相同域的数据. 如何叫“同源”或者“同域”呢?——协议.域名.端口号都必须相同 ...