题意: 有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个(母函数)的更多相关文章

  1. hdu 2069 限制个数的母函数(普通型)

    Coin Change Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  2. HDU 2069 Coin Change

    Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total S ...

  3. 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command)

    [源码下载] 背水一战 Windows 10 (25) - MVVM: 通过 x:Bind 实现 MVVM(不用 Command) 作者:webabcd 介绍背水一战 Windows 10 之 MVV ...

  4. /proc/interrupts 统计2.6.38.8与3.10.25差异

    eth4进,eth5出 linux-3.10.25 67:          2          3          2          3   PCI-MSI-edge     eth468: ...

  5. 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 ...

  6. 10.25 正睿停课训练 Day9

    目录 2018.10.25 正睿停课训练 Day9 A 数独(思路 DP) B 红绿灯(最短路Dijkstra) C 轰炸(计算几何 圆并) 考试代码 B C 2018.10.25 正睿停课训练 Da ...

  7. 题解报告:hdu 2069 Coin Change(暴力orDP)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2069 Problem Description Suppose there are 5 types of ...

  8. Java习题10.25

    Java习题10.25 1. 实际上这道题考查的是两同两小一大原则: 方法名相同,参数类型相同 子类返回类型小于等于父类方法返回类型, 子类抛出异常小于等于父类方法抛出异常, 子类访问权限大于等于父类 ...

  9. windows 10 超级优化,同时解决本地磁盘100%的问题

    windows 10 超级优化,同时解决本地磁盘100%的问题 我的系统是笔记本I7处理器,配置了web服务器IIS 和一个数据库(mysql7),同时启用了虚拟机(表中已禁用),以及安装了offic ...

随机推荐

  1. Laravel 限流中间件 throttle 简析

    1. 在Laravel 中配置 在 app\Http\Kernel.php 中,默认添加到中间件组 api 下,1分钟60次. 2. 限流原理 获取唯一请求来源,进行唯一标识(key) 获取该请求请求 ...

  2. poj 1284 Primitive Roots (原根)

    Primitive Roots http://poj.org/problem?id=1284 Time Limit: 1000MS   Memory Limit: 10000K       Descr ...

  3. [问题]SqlServer创建数据库出错

    SqlServer 2008 “Msg 1807, Level 16, State 3, Line 1Could not obtain exclusive lock on database ‘mode ...

  4. 安装Win8引起Ubuntu启动项丢失的恢复过程

    画电路图的时候手痒,于是将之前做好的Win8PE拿出来装着玩儿.至于Win8的pE很好做,用UltraISO将Win8 的镜像用制作硬盘镜像的方法烧进U盘就行了. Win8的安装过程也很简单.安装前为 ...

  5. php 传递赋值和地址赋值 &

    更多内容推荐微信公众号,欢迎关注: 1.传递赋值 $a = 1; $b = 2; $a = $b; echo $a,$b; //结果为:5 5 2.地址赋值 $a = 1; $b = 2; $a = ...

  6. post请求远程url 报错“基础连接已经关闭...Authentication.AuthenticationException...远程证书无效”解决方案

    当我们有时用代码编写post请求url远程地址会报“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系. ---> System.Security.Authentication.A ...

  7. 【译】第七篇 Integration Services:中级工作流管理

    本篇文章是Integration Services系列的第七篇,详细内容请参考原文. 简介在上一篇文章,我们创建了一个新的SSIS包,学习了SSIS中的脚本任务和优先约束,并检查包的MaxConcur ...

  8. tensorflow环境安装

    tensorflow环境安装1.安装虚拟机Virtrualbox下载地址:https://www.virtualbox.org/wiki/Downloads 2.下载安装Ubuntu镜像下载地址:ht ...

  9. std::max 错误

    Today I typed the following: int t = (std::max)(timeout, lagtime); Why did I put parentheses around ...

  10. shell脚本编程之“最简单的死循环”【转】

    转自:http://blog.chinaunix.net/uid-23046336-id-3475462.html 在linux下编程的程序猿都知道shell脚本,就算你不怎么熟悉,也应该听过的吧!那 ...