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. 5 月编程语言排行榜:Java第一,R跌出Top20

    我们都知道,最近,TIOBE 发布了 5 月份编程语言排行榜.其中,前三名依然健稳不变,他们分别是 Java.C.C++,第四则为: Python ,第五则为 VB .NET. 下面两张图,我们可以看 ...

  2. CSS3实现边框线条动画特效

    <div class="box-line"></div> CSS代码 .box-line, .box-line::before, .box-line::af ...

  3. Glide清除缓存

    Glide是谷歌推荐的一款加载图片的第三方框架,对内存优化更好,更省资源,他的众多好处,我就不一一描述了,有兴趣的朋友可以百度一下,介绍的还是挺详细的. 今天主要给大家介绍一下关于怎么获取Glide的 ...

  4. Android基础夯实--重温动画(三)之初识Property Animation

    每个人都有一定的理想,这种理想决定着他的努力和判断的方向.就在这个意义上,我从来不把安逸和快乐看作生活目的的本身--这种伦理基础,我叫它猪栏的理想.--爱因斯坦 一.摘要 Property Anima ...

  5. 老潘 - ListView分析 - 学以致用篇(一)

    ListView分析学以致用篇(1) 在我们查看别人的博客的时候,一个人是一个风格的.先说下我的风格,我喜欢思想类比,然后介绍知识,不太喜欢填鸭式的灌输.如果只是想单纯的从我的博客中直接看到代码,我个 ...

  6. applicationContext.getBean(“loginEntity”)

    <!-- 指定Spring需要扫描的包,并将所有是别的类放到容器中,便于识别被注解的受托管bean --> <context:component-scan base-package= ...

  7. apache反向代理配置

    apache简单的反向代理配置 Proxypass /api /http://locahost:3000 反向代理-1.jpg

  8. Laravel 使用中间件进行权限控制

    Laravel 使用中间件进行权限控制 飞凡的陀螺 关注 2018.01.24 17:45 字数 264 阅读 1138评论 0喜欢 1 先看 文档Laravel 中间件提供了一种方便的机制来过滤进入 ...

  9. linux查看内核版本和发行版本号

    1.查看Linux内核版本号:1.1 uname -r #查看当前linux系统的内核版本号显示举例:2.6.21-1.3194.fc71.2 uname -a #可以查看包括内核版本号.机器硬件信息 ...

  10. ArrayList集合的特点和几种遍历方法

    public class temp { public static void main(String[] args)throws Exception { ArrayList 在定义时长度为空 ,在新增 ...