//给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数
//G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3),
//展开,系数不为0的数都是能够由硬币组合出来的。
# include <algorithm>
# include <string.h>
# include <stdio.h>
# include <iostream>
using namespace std;
int main()
{
int i,j,k,max1;
int c1[8100],c2[8100],a[10];
while(~scanf("%d%d%d",&a[1],&a[2],&a[5]),a[1]+a[2]+a[5])
{
max1=a[1]+a[2]*2+a[5]*5;
for(i=0;i<=8100;i++)
{
c1[i]=0;
c2[i]=0;
}
for(i=0;i<=a[1];i++)//第一种硬币
c1[i]=1;
for(i=2;i<=5;i+=3)
{
for(j=0;j<=8100;j++)
{
for(k=0;k*i+j<=8100&&k<=a[i];k++)
{
c2[j+k*i]+=c1[j];
}
}
for(j=0;j<=8100;j++)
{
c1[j]=c2[j];
c2[j]=0;
}
}
for(i=1;i<=8100;i++)
if(c1[i]==0)
{
printf("%d\n",i);
break;
} }
return 0;
}

hdu 1085 Holding Bin-Laden Captive! (母函数)的更多相关文章

  1. HDU 1085 Holding Bin-Laden Captive! (母函数)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  2. HDU 1085 Holding Bin-Laden Captive!(母函数,或者找规律)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  3. HDOJ/HDU 1085 Holding Bin-Laden Captive!(非母函数求解)

    Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...

  4. HDU 1085 Holding Bin-Laden Captive! 活捉本拉登(普通型母函数)

    题意: 有面值分别为1.2.5的硬币,分别有num_1.num_2.num_5个,问不能组成的最小面值是多少?(0<=每种硬币个数<=1000,组成的面值>0) 思路: 母函数解决. ...

  5. HDU 1085 Holding Bin-Laden Captive!(DP)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085 解题报告:有1,2,5三种面值的硬币,这三种硬币的数量分别是num_1,num_2,num_5, ...

  6. hdu 1085 Holding Bin-Laden Captive!

    Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...

  7. HDU 1085 Holding Bin-Laden Captive --生成函数第一题

    生成函数题. 题意:有币值1,2,5的硬币若干,问你最小的不能组成的币值为多少. 解法:写出生成函数: 然后求每项的系数即可. 因为三种硬币最多1000枚,1*1000+2*1000+5*1000=8 ...

  8. hdu 1085 给出数量限制的母函数问题 Holding Bin-Laden Captive!

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  9. HDOJ 1085 Holding Bin-Laden Captive! (母函数)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

随机推荐

  1. atan(正切函数)

    atan函数:返回数值的余切值 原型:double atan(double x) <pre name="code" class="cpp">#inc ...

  2. robot framework环境搭建和简单示例

    环境搭建 因为我的本机已经安装了python.selenium.pip等,所以还需安装以下程序 1.安装wxPythonhttp://downloads.sourceforge.net/wxpytho ...

  3. codeforces 650D. Zip-line 线段树

    题目链接 题目的意思很简单, 就是给你n个数, m个询问, 每次询问修改某一个位置的值, 然后问你修改完之后数列的lis是多少. 询问独立. 对于原数列, 我们将它离散化, 令dp1[i]为以i为结尾 ...

  4. latex 常用小结

    在写论文,甚至有些课程的报告的时候,latex是常用的工具.这篇博文简单的记录了latex常用的一些内容. 1 基本模块 没用过latex的读者,最想问的问题莫过于latex的 “hello worl ...

  5. 14-C语言宏

    目录: 一.宏定义 二.#x,##x使用和预定义宏 三.宏的高级使用(条件编译) 回到顶部 一.宏定义 1 宏是常用的预处理功能之一,是在编译之前进行宏替换,即将宏名替换成所定义的宏体. 2 优点:可 ...

  6. 我的MYSQL学习心得 mysql的权限管理

    这一篇<我的MYSQL学习心得(十三)>将会讲解MYSQL的用户管理 在mysql数据库中,有mysql_install_db脚本初始化权限表,存储权限的表有: 1.user表 2.db表 ...

  7. ios 中生成二维码和相册中识别二维码

    iOS 使用CIDetector扫描相册二维码.原生扫描 原生扫描 iOS7之后,AVFoundation让我们终于可以使用原生扫描进行扫码了(二维码与条码皆可)AVFoundation可以让我们从设 ...

  8. asp.net MVC过滤器的用法(转)

    转自:http://www.studyofnet.com/news/257.html APS.NET MVC中的每一个请求,都会分配给相应的控制器和对应的行为方法去处理,而在这些处理的前前后后如果想再 ...

  9. sql 月初和月末

    --月初 select  convert(varchar(10),dateadd(day,-(day(getdate()) -1),getdate()) ,120) --月末select  conve ...

  10. 关于MVC EntityType has no key defined的问题

    关于MVC EntityType has no key defined的问题 在测试MVC时发现一个奇怪的问题,在Model中定义数据类时,如 public class UserInfo { publ ...