简单的母函数应用。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<cctype>
#include<sstream>
using namespace std;
#define pii pair<int,int>
#define LL long long int
const double eps=1e-;
const int INF=;
const int maxn=+;
int c1[maxn],n1,n2,n5;
int main()
{
//freopen("in1.txt","r",stdin);
//freopen("out.txt","w",stdout);
while(~scanf("%d%d%d",&n1,&n2,&n5))
{
if(n1==&&n2==&&n5==) break;
memset(c1,,sizeof(c1)); for(int i=; i<=n1; i++)//第一个括号
{
c1[i]=;
}
//第二个括号
for(int j=; j<=n1; j++)
{
for(int k=; k<=*n2; k+=)
{
c1[k+j]=;
//cout<<k+j<<endl;
}
}
//第三个括号
for(int j=;j<=n1+*n2;j++)
{
for(int k=;k<=*n5;k+=)
{
if(c1[j])
{
c1[j+k]=;
}
}
}
for(int i=;; i++)
{
if(c1[i]==)
{
printf("%d\n",i);
break;
}
}
}
return ;
}

hdu1085 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. HDU1085 Holding Bin-Laden Captive!

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

  3. hdu 1085 Holding Bin-Laden Captive! (母函数)

    //给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数 //G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3), //展 ...

  4. 【hdoj_1085】Holding Bin-Laden Captive![母函数]

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1085 可以这样理解题意:给出1元,2元和5元的三种硬币若干,每种硬币数量给出,现在可以从所有的硬币中,选出 ...

  5. hdu1085 Holding Bin-Laden Captive!【生成函数】

    列出生成函数的多项式之后暴力乘即可 #include<iostream> #include<cstdio> #include<cstring> using name ...

  6. A过的题目

    1.TreeMap和TreeSet类:A - Language of FatMouse ZOJ1109B - For Fans of Statistics URAL 1613 C - Hardwood ...

  7. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

  8. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  9. 缓冲区溢出利用——捕获eip的傻瓜式指南

    [译文] 摘要:为一个简单的有漏洞程序写一个简单的缓冲区溢出EXP,聚焦于遇到的问题和关键性的教训,提供详细而彻底的描述 内容表:1. I pity the fool, who can't smash ...

随机推荐

  1. python常用模块——hashlib模块

    Python的hashlib提供了常见的摘要算法,如md5.sha1等 什么是摘要算法了?摘要算法又称哈希算法.散列算法. 它通过一个函数,把任意长度的数据转化魏一个长度固定的数据串(通常用十六进制的 ...

  2. eclipse修改web项目部署路径 wtpwebapps webapps 的设置

    eclipse修改web项目部署路径 wtpwebapps   webapps  的设置,在添加完server------>tomcat后,到server控制台进行设置 eclipse默认的部署 ...

  3. vagrant搭建

    1.在官网下载对应的vagrant版本 https://www.vagrantup.com/downloads.html (下载最新版本) https://releases.hashicorp.com ...

  4. 机器学习算法之:KNN

    基于实例的学习方法中,最近邻法和局部加权回归法用于逼近实值或离散目标函数,基于案例的推理已经被应用到很多任务中,比如,在咨询台上存储和复用过去的经验:根据以前的法律案件进行推理:通过复用以前求解的问题 ...

  5. 【HackerRank】Game Of Rotation

    题目连接:Game Of Rotation Mark is an undergraduate student and he is interested in rotation. A conveyor ...

  6. 【CodeChef】Small factorials(BigInteger笔记)

    You are asked to calculate factorials of some small positive integers. Input An integer t, 1<=t&l ...

  7. CentOS 7 导入epel库

    yum install epel-release 或者到百度云下载相应的 rpm 包进行安装 rpm -ivh epel-release-7-9.noarch.rpm

  8. RHEL7 LAMP

    准备篇: RHEL 7.0系统安装配置图解教程:http://www.osyunwei.com/archives/7702.html 一.使用系统镜像文件配置本地yum源 1.使用WinSCP.exe ...

  9. Python安装setuptools时报Compression requires the (missing) zlib

    装机员为您提供Python安装setuptools时报Compression requires the (missing) zlib的文章咨询供您阅读,如何使用Python安装setuptools时报 ...

  10. 39条常见的linux系统管理面试题

    1.如何看当前Linux系统有几颗物理CPU和每颗CPU的核数? 答:[root@centos6 ~ 10:55 #35]# cat /proc/cpuinfo|grep -c 'physical i ...