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. Android中轻松使用线程

     当你第一次启动一个Android程序的时候,一个被 称为"main"的线程就被自动创建了.它被称为主线程或者UI线程,它是非常重要的因为负责分发事件给对应的widget,还包含画 ...

  2. Android 中Activity,Window和View之间的关系

    转自:http://hi.baidu.com/xiaofanqing/blog/item/8261ac114ab14f64cb80c435.html 我这里根据我个人的理解来讲讲我个人对这3个概念的理 ...

  3. win+D可以最小化所有窗口,显示桌面 win+E可以快速打开我的电脑 这两个对我来说非常常用,要用熟练,节约时间

    win+D可以最小化所有窗口,显示桌面   win+E可以快速打开我的电脑

  4. 微信小程序转支付宝小程序

    使用方法: npm install wx-alipay -g wxToalipay --src={{小程序源码目录}} --dest={{支付宝小程序目录,可缺省}} 点击回车后就可将微信小程序转换为 ...

  5. MpVue解析

    前言 mpvue是一款使用Vue.js开发微信小程序的前端框架.使用此框架,开发者将得到完整的 Vue.js 开发体验,同时为H5和小程序提供了代码复用的能力.如果想将 H5 项目改造为小程序,或开发 ...

  6. php curl请求。header头中添加请求信息

    function get_data($key,$authorization,$url){ $headers = array(    'api-key:'.$key,    'authorization ...

  7. Shell 参数(1)

    shell 中参数相关: ./a.sh a b c d $# 是传给脚本的参数个数 $0 是脚本本身的名字 $1 是传递给该shell脚本的第一个参数 $2 是传递给该shell脚本的第二个参数 $@ ...

  8. linux之使用samba实现文件共享

    早期网络想要在不同主机之间共享文件大多要用FTP协议来传输,但FTP协议仅能做到传输文件却不能直接修改对方主机的资料数据,这样确实不太方便,于是便出现了NFS开源文件共享程序,NFS是一个能够将多台L ...

  9. CS与BS区别

    简介:CS即Client/Server(客户机/服务器)结构,C/S结构在技术上很成熟,它的主要特点是交互性强.具有安全的存取模式.网络通信量低.响应速度快.利于处理大量数据.但是该结构的程序是针对性 ...

  10. JAVA软件配置—环境变量

    环境Windows10,JDK,JRE1.8.0_102 鼠标右击左下角Windows图标,选择"系统"项: 点击"高级系统设置"——"环境变量&qu ...