//给你面值为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. html回车事件

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  2. 定义一个runtime的Annotation

    import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(value ...

  3. VS2012破解_序列号

    中文版:http://download.microsoft.com/download/B/0/F/B0F589ED-F1B7-478C-849A-02C8395D0995/VS2012_ULT_chs ...

  4. hdu 3980 Paint Chain sg函数

    题目链接 给一个长度为n的环, 两个人轮流涂色, 每次涂m个连续的, 无法继续涂了就输. #include<bits/stdc++.h> using namespace std; #def ...

  5. Python的maketrans() 方法

    描述 Python maketrans() 方法用于创建字符映射的转换表,对于接受两个参数的最简单的调用方式,第一个参数是字符串,表示需要转换的字符,第二个参数也是字符串表示转换的目标. 注:两个字符 ...

  6. Telnet自动登录

    http://zw7534313.iteye.com/blog/1603808 http://network.51cto.com/art/201007/212255_all.htm (s=`stty ...

  7. spring+springMVC集成(annotation方式)

    spring+springMVC集成(annotation方式) SpringMVC+Spring4.0+Hibernate 简单的整合 MyBatis3整合Spring3.SpringMVC3

  8. AppStore被拒原因及总结

    4.5 - Apps using background location services must provide a reason that clarifies the purpose of th ...

  9. UI基础:UILabel.UIFont

    UILabel:标签 继承自UIView ,在UIView基础上扩充了显示文本的功能.(文本框) UILabel的使用步骤 1.创建控件 UILabel *aLabel=[[UILabel alloc ...

  10. CSS文字样式

    font-family:通常文章的正文使用的是易读性较强的serif字体,用户长时间阅读下不easy疲劳.而标题和表格则採用较醒目的sans-serif字体.Web设计及浏览器设置中也推荐遵循此原则. ...