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. Chrome字体变粗

    如图.解决方案,看看CSS中用了什么字体,卸载某个字体. 因为我装了一个新的字体,CSS中有这个字体的网页都会变粗.删掉这个字体就恢复正常了

  2. kubernetes1.7正式发布

    Kubernetes发布历史回顾 Kubernetes 1.0 - 2015年7月发布 Kubernetes 1.1 - 2015年11月发布 Kubernetes 1.2 - 2016年3月发布 K ...

  3. Markdown转HTML之Node篇

    前言 环境及编码 搭建环境 express markdown-it commander rd 核心编码 cmd_preview模块 cmd_build模块 打造命令行工具 写点xxmd 演示 总结 前 ...

  4. Windows Phone 8 Programming Considerations

    OpenGL ES 2.0 Support Marmalade supports the Open GL ES 2.0 Graphics API on Windows Phone 8 using a ...

  5. 为什么要使用ORM技术?和 JDBC 有何不一样?

    为什么要使用ORM技术?和 JDBC 有何不一样?        1.繁琐的代码问题:        用JDBC的API编程访问数据库,代码量较大,特别是访问字段较多的表的时候,代码显得繁琐.累赘,容 ...

  6. WCF日志跟踪SvcTraceViewer.exe

    参考: https://msdn.microsoft.com/zh-cn/library/ms732023.aspx https://msdn.microsoft.com/zh-cn/library/ ...

  7. c# 统计运行时间

    long startTime = Environment.TickCount; long endTime = Environment.TickCount; long totalTime = endTi ...

  8. Vue.js 中的动态路由

    静态路由是不可以传递参数的.需要传递参数得用到动态路由 那么如何将参数作为路由呢? //在参数名前面加上 : ,然后将参数写在路由的 path 内 routes: [ //将页面组件与path指令的路 ...

  9. Web缓存技术

    本章导读 缓存主要是为了提高数据的读取速度.因为服务器和应用客户端之间存在着流量的瓶颈,所以读取大容量数据时,使用缓存来直接为客户端服务,可以减少客户端与服务器端的数据交互,从而大大提高程序的性能. ...

  10. ASP.NET Cache缓存的使用

    ASP.NET Cache是提升系统性能的重要方法,它使用了“最近使用”原则(a least-recently-used algorithm).在数据库访问中经常会用到Cache保存数据库数据. 1. ...