Holding Bin-Laden Captive!

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12069    Accepted Submission(s): 5394

Problem Description
We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China!
“Oh, God! How terrible! ”

Don’t be so afraid, guys. Although he hides in a cave of Hang Zhou, he dares not to go out. Laden is so bored recent years that he fling himself into some math problems, and he said that if anyone can solve his problem, he will give himself up!
Ha-ha! Obviously, Laden is too proud of his intelligence! But, what is his problem?
“Given some Chinese Coins (硬币) (three kinds-- 1, 2, 5), and their number is num_1, num_2 and num_5 respectively, please output the minimum value that you cannot pay with given coins.”
You, super ACMer, should solve the problem easily, and don’t forget to take $25000000 from Bush!

 
Input
Input contains multiple test cases. Each test case contains 3 positive integers num_1, num_2 and num_5 (0<=num_i<=1000). A test case containing 0 0 0 terminates the input and this test case is not to be processed.
 
Output
Output the minimum positive value that one cannot pay with given coins, one line for one case.
 
Sample Input
1 1 3 0 0 0
 
Sample Output
4
 
Author
lcy
 
 
母函数问题。。。。。
 
 #include<iostream>
#define maxn 9000
using namespace std;
int c1[maxn],c2[maxn];
int main()
{
int num1,num2,num3,i,j;
while(cin>>num1>>num2>>num3,num1+num2+num3)
{
memset(c1,,sizeof(c1));
memset(c2,,sizeof(c2));
for(i=;i<=num1;i++)
{
c1[i]=;
for(j=;j<=num2;j++)
{
c2[*j+i]+=c1[i];
}
}
for(i=;i<=num1+*num2;i++)
{
c1[i]=c2[i];
c2[i]=;
}
for(i=;i<=num1+*num2;i++)
{
for(j=;j<=num3;j++)
{
c2[i+*j]+=c1[i];
}
}
for(i=;i<=num1+*num2+*num3;i++)
{
if(c2[i]==)
{
break;
}
}
cout<<i<<endl;
}
return ;
}

HDUOJ--Holding Bin-Laden Captive!的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

  7. Holding Bin-Laden Captive!(母函数)

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

  8. Holding Bin-Laden Captive!(杭电1085)(母函数)

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

  9. Holding Bin-Laden Captive!(1.多重背包 2.母函数)

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

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

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

随机推荐

  1. HTTP 无状态啊无状态啊

    无状态的根本原因 根本原因是:因为,HTTP协议使用的是Socket套接字TCP连接的,每次监听到的套接字连接是不可能一个个保存起来的.(很消耗资源,假如一个人服务器只保存一个通信连接,一万个岂不是要 ...

  2. Python3.6学习笔记(二)

    Python 的高级特性 切片 对于指定索引范围取值的操作,Python提供了slice方法,类似于Excel中数据透视表的切片器. >>> L = ['Michael', 'Sar ...

  3. L'Hospital法则及其应用

      from: http://math.fudan.edu.cn/gdsx/XXYD.HTM

  4. 我所遭遇过的游戏中间件---HumanIK

    我所遭遇过的游戏中间件---HumanIK Autodesk HumanIK游戏中间件,为游戏创建更加可信.真实的角色动画.该中间件的全身逆向运动(FBIK)系统支持角色真实地与所在环境及其它角色进行 ...

  5. 3 Sum leetcode java

    题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find al ...

  6. CIF、QCIF

    分辨率: 每个像素的存储方式都是YUV   QQCIF:88*72 QCIF:176*144 CIF:352*288 2CIF:704*288 DCIF:584*384 4CIF:704*576   ...

  7. C++:cin、cin.getline()、getline()的用法

    主要内容: 1.cin用法 2.cin.getline()用法 3.getline()用法 3.注意的问题 一.cin>> 用法1:输入一个数字或字符 #include <iostr ...

  8. ArcEngine开发各种几何错误代码

    E_GEOMETRY_AMBIGUOUSPARTTYPE - Static variable in interface com.esri.arcgis.geometry.esriGeometryErr ...

  9. 能说明你的Javascript技术很烂的五个原因

    Javascript在互联网上名声很臭,但你又很难再找到一个像它这样如此动态.如此被广泛使用.如此根植于我们的生活中的另外一种语言.它的低学习门槛让很多人都称它为学前脚本语言,它另外一个让人嘲笑的东西 ...

  10. ZH奶酪:Word断字功能不可用。请运行Microsoft Office安装程序安装该功能,然后重试。

    断字功能就是英文单词遇到换行时候会自动添加一个“-”符号来连接跨行的单词. 此外,英文单词拼写校验的功能也是这样添加. 问题如图所示: 解决方法: 打开安装程序“setup.exe”——点击“添加或删 ...