Holding Bin-Laden Captive!

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

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 <stdio.h>
#include <string.h>
int c1[],c2[];
int main()
{
int num_1,num_2,num_5;
while(scanf("%d%d%d",&num_1,&num_2,&num_5),num_1||num_2||num_5)
{
int i,j,k,n;
n = num_1+*num_2+*num_5;
memset(c1,,sizeof(c1));
memset(c2,,sizeof(c2));
for(i=;i<=num_1;i++)
c1[i]=;
for(j=;j<=(num_1+*num_2);j++)
for(k=;k+j<=n;k+=)
c2[k+j]+=c1[j];
for(j=;j<=(num_1+*num_2);j++)
c1[j]=c2[j];
memset(c2,,sizeof(c2));
for(j=;j<=n;j++)
for(k=;k+j<=n;k+=)
{
c2[k+j]+=c1[j];
}
for(j=;j<=n;j++)
c1[j]=c2[j];
for(i=;i<=n;i++)
if(!c1[i])
{
printf("%d\n",i);
break;
}
if(i>n)
printf("%d\n",n+);
}
return ;
}

hdu_1085_Holding Bin-Laden Captive!_201404261008的更多相关文章

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

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

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

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

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

  4. HDU_1085_Holding Bin-Laden Captive!_母函数

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

  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. HDU 1085-Holding Bin-Laden Captive!(生成功能)

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

随机推荐

  1. 在Stuts2中使用ModelDriven action

    在Struts2中,提供了另外一种直接使用领域对象的方式,那就是让action实现com.opensymphony.xwork2.ModelDriven接口.ModelDriven让你可以直接操作应用 ...

  2. ABP教程(二)- 将ABP在本地运行起来

    上一篇 我们介绍了什么是ABP,这一篇我们通过原作者的”简单任务系统”例子,演示如何运用ABP开发项目 从模板创建空的web应用程序 ABP提供了一个启动模板用于新建的项目(尽管你能手动地创建项目并且 ...

  3. 谷歌的 I/O 2019,究竟推出了什么新特性?

    前言 昨天,也即赶在微软 Build 2019 的第二天,一年一度的2019年 Google I/O大会在美国如期举行,Google I/O 2019全纪录:AI惊艳,Android Q真香,包括两款 ...

  4. iOS Programming NSUserDefaults

    iOS Programming NSUserDefaults  When you start an app for the first time, it uses its factory settin ...

  5. JavaScript线程

    JavaScript的setTimeout与setInterval是两个很容易欺骗别人感情的方法,因为我们开始常常以为调用了就会按既定的方式执行, 我想不少人都深有同感, 例如 setTimeout( ...

  6. js中cookie的操作

    JavaScript中的另一个机制:cookie,则可以达到真正全局变量的要求. cookie是浏览器 提供的一种机制,它将document 对象的cookie属性提供给JavaScript.可以由J ...

  7. Node.js——post方式提交的图片如何保存

    https://www.cnblogs.com/bruce-gou/p/6399766.html 没有使用express框架,主要是对于 request 的监听,data的时候对数据进行保存,end的 ...

  8. 异常详细信息: System.ComponentModel.Win32Exception: 信号灯超时时间已到

  9. WPF动画 - Loading加载动画

    存在问题: 最近接手公司一个比较成熟的产品项目开发(WPF桌面端),其中,在登陆系统加载时,60张图片切换,实现loading闪烁加载,快有密集恐惧症了!!! 代码如下: private void L ...

  10. proposal_layer.py层解读

    proposal_layer层是利用训练好的rpn网络来生成region proposal供fast rcnn使用. proposal_layer整个处理过程:1.生成所有的anchor,对ancho ...