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 ...
随机推荐
- UDP ------ UDP 详解
原文地址:https://zhuanlan.zhihu.com/p/25622691 3. UDP疑难杂症 3.1 UDP的传输方式:面向报文 面向报文的传输方式决定了UDP的数据发送方式是一份一份的 ...
- CSS--overflow和hover
一.Overflow overflow 属性规定当内容溢出元素框时发生的事情. 当插入的一张图片大小超过了元素本身大小,就会将元素撑大 <!DOCTYPE html> <html l ...
- java基础-System类常用方法介绍
java基础-System类常用方法介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.System类概念 在API中system类介绍的比较简单,我们给出定义,system中 ...
- 蓝桥杯 剪邮票 DFS (不错的题目)
剪邮票 如[图1.jpg], 有12张连在一起的12生肖的邮票.现在你要从中剪下5张来,要求必须是连着的.(仅仅连接一个角不算相连)比如,[图2.jpg],[图3.jpg]中,粉红色所示部分就是合格的 ...
- 【重要】Nginx模块Lua-Nginx-Module学习笔记(三)Nginx + Lua + Redis 已安装成功(非openresty 方式安装)
源码地址:https://github.com/Tinywan/Lua-Nginx-Redis 一. 目标 使用Redis做分布式缓存:使用lua API来访问redis缓存:使用nginx向客户端提 ...
- Java并发编程原理与实战五:创建线程的多种方式
一.继承Thread类 public class Demo1 extends Thread { public Demo1(String name) { super(name); } @Override ...
- [整理]基于bootstrap的文本编辑器
http://www.bootcss.com/p/bootstrap-wysiwyg/ http://jhollingworth.github.io/bootstrap-wysihtml5/ http ...
- td自动换行
自动换行方法: 1.在<td>中设置样式style为word-wrap:break-word;word-break:break-all; (一般情况只需要设置word-break:brea ...
- Hive笔记之数据库操作
创建数据库 hive创建数据库的最简单写法和mysql差不多: create database foo; 仅当名为foo的数据库当前不存在时才创建: create database if not ex ...
- python概念-各类绑定的概念和property的变态一面
# 编辑者:闫龙 # 1.什么是绑定到对象的方法,如何定义,如何调用,给谁用?有什么特性 #在类中定义的(self)方法都是绑定到对象的方法 #定义 class a: def b(self):#绑定到 ...