列出生成函数的多项式之后暴力乘即可

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=20005;
int n,x,y,z,a[N],b[N];
int main()
{
while(scanf("%d%d%d",&x,&y,&z)&&x+y+z)
{
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
n=x+y*2+z*5;
for(int i=0;i<=x;i++)
a[i]=1;
for(int i=0;i<=n;i++)
for(int j=0;j<=y*2;j+=2)
b[i+j]+=a[i];
for(int i=0;i<=n;i++)
a[i]=b[i],b[i]=0;
for(int i=0;i<=n;i++)
for(int j=0;j<=z*5;j+=5)
b[i+j]+=a[i];
for(int i=0;i<=n+1;i++)
if(!b[i])
{
printf("%d\n",i);
break;
}
}
return 0;
}

hdu1085 Holding Bin-Laden Captive!【生成函数】的更多相关文章

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

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

  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. hdu1085 Holding Bin-Laden Captive!(母函数)

    简单的母函数应用. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstrin ...

  4. A过的题目

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

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

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

  6. 用主题模型可视化分析911新闻(Python版)

    本文由 伯乐在线 - 东狗 翻译,toolate 校稿.未经许可,禁止转载!英文出处:blog.dominodatalab.com.欢迎加入翻译小组. 本文介绍一个将911袭击及后续影响相关新闻文章的 ...

  7. How do I learn mathematics for machine learning?

    https://www.quora.com/How-do-I-learn-mathematics-for-machine-learning   How do I learn mathematics f ...

  8. Labeled Faces in the Wild 人脸识别数据集 部分测试数据

    development test set Note: images displayed are original (non-aligned/funneled) images. match pairs ...

  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. C#.net word excel powerpoint (ppt) 转换成 pdf 文件

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  2. c程序设计语言第一章1

    1,c程序都是由函数和变量组成的. 练习1.6验证布尔表达式getchar()!= EOF的取值是0还是1 答: #include <stdio.h> #include <stdli ...

  3. c#中的多态 c#中的委托

    C#中的多态性          相信大家都对面向对象的三个特征封装.继承.多态很熟悉,每个人都能说上一两句,但是大多数都仅仅是知道这些是什么,不知道CLR内部是如何实现的,所以本篇文章主要说说多态性 ...

  4. 父节点parentNode

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  5. HDU 1114 Piggy-Bank (完全背包)

    Piggy-Bank Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  6. IOS 获取设备本地音视频

    1.检索音视频 PHFetchOptions *allPhotosOptions; @property (nonatomic, strong) PHFetchResult *assetsFetchRe ...

  7. FragmentSharedFabTransition

    https://github.com/lgvalle/FragmentSharedFabTransition

  8. 使用string实现一个用于储存那些太大而无法使用 long long 的数

    类的定义: class stringInt { public: stringInt(); stringInt(string num); stringInt(int num); stringInt op ...

  9. openwrt gstreamer实例学习笔记(一.初始化gstreamer)

    GStreamer 是一个非常强大而且通用的流媒体应用程序框架. GStreamer所具备的很多优点来源于其框架的模块化: GStreamer能够无缝的合并新的插件. 但是, 由于追求模块化和高效率, ...

  10. Session Timeout 与 $.ajaxSetup

    对于session过期跳转的问题,很简单,就是一个过滤器,然后判断session为空?跳转:继续.但是对于ajax的请求,需要做特殊处理,见下面代码中的 // 此处考虑ajax操作session过期的 ...