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!

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

OutputOutput 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
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<iostream>
#include<map>
#include<vector>
#define Inf 0x3f3f3f3f
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
const int MXAN=+;
int dp[];
int str[];
int main()
{
ll m,n,p,i,j,pos;
ll a[MXAN];
ll b[MXAN];
ll value[]={,,,};
ll num[];
while(cin>>num[]>>num[]>>num[])
{
if(num[]+num[]+num[]==)
break;
ll m=num[]*value[]+num[]*value[]+num[]*value[];
for(ll i=;i<=m;i++)
{
a[i]=;
b[i]=;
}
a[m+]=;
ll len=value[]*num[];
for(ll i=;i<=;i++)
{
len+=value[i]*num[i];
for(ll j=;j<=len-value[i]*num[i];j++)
{
for(ll k=;k+j<=len;k+=value[i])
{
b[k+j]+=a[j];
}
}
for(ll j=;j<=len;j++)
{
a[j]=b[j];
b[j]=;
}
}
for(ll i=;i<=;i++)
{
if(a[i]==)
{
cout<<i<<endl;
break;
}
} }
return ;
}
												

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. AutoLayout 使用详细

    1.实际应用中,这Compact,Any,Regular如何运用呢? w:Any h:Any 是我们刚建立工程时候默认选择的,算是一切描述的父类.其他的种类描述都是在此基础上变化的,比如:如果weig ...

  2. sphinx使用

    一. 1.先得包含下载的文件 include'./sphinx/api/sphinxapi.php'; $sphinx= new SphinxClient(); $sphinx->SetServ ...

  3. HTML的后缀显示、标准格式和标签(1)

    后缀的显示 win10:打开我的计算机--->点击上面的查看--->选中文件扩展名 win8:打开我的计算机--->点击上面的组织选中文件夹选项--->点击上面的查看---&g ...

  4. Matisse,来自知乎的PhotoPicker

    简介 Matisse,是一款由知乎开源的媒体选择器. 在Activity和Fragment中使用 支持JPEG,PNG,GIF的图片选择和MPEG,MP4格式的视频选择.不能同时选择图片和视频 两种主 ...

  5. golang:bson.ObjectId与string转化

    网上资料不好搜,记下来:两个变量:id bson.ObjectIdstr string bson.ObjectId—>string id.Hex() string—>bson.Object ...

  6. window如何分区

    WD官方技术支持电话:800热线800-820-6682(请于周一至周五工作日期间使用固定电话拨打,不支持手机用户)手机用户请拨打400-627 6682. 链接:https://kuyusm.tma ...

  7. yield关键字用法与解析(C# 参考)

    yield 关键字向编译器指示它所在的方法是迭代器块. 编译器生成一个类来实现迭代器块中表示的行为. 在迭代器块中,yield 关键字与 return 关键字结合使用,向枚举器对象提供值. 这是一个返 ...

  8. OpenSSH 使用技巧

    1. 取消 OpenSSH 初次连接 yes 确认 在脚本中有时会使用ssh进行远程连接操作,如果是第一次 ssh 连接往往会提示你是否确认连接并要求你输入yes, 才能继续.如何才能避免这个步骤呢? ...

  9. 如何给 FastAdmin 单独设置域名

    如何给 FastAdmin 单独设置域名 (声明:不建议给后台固定的域名,主要是安全问题) FastAdmin 是基于 ThinkPHP5 框架编写的,ThinkPHP 5 支持域名路由,可对模块单独 ...

  10. bzoj 3501 PA2008 Cliquers Strike Back——贝尔数

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3501 用贝尔三角形 p^2 地预处理 p 以内的贝尔数.可以模(mod-1)(它是每个分解下 ...