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. js点击修改按钮后修改

    <button id="click">改变内容</button> <div id="t">要改变的内容</div> ...

  2. 解决ef第一次启动较慢

    protected void Application_Start() { //禁用第一次ef查询对表__MigrationHistory的问题使用了ef的Code first会在第一次ef查询的时候会 ...

  3. scala如何在任意方法中打印当前线程栈信息(StackTrace)

    1.以wordcount为例 package org.apache.spark.examples import org.apache.spark.{SparkConf, SparkContext} / ...

  4. Request.Form("id")与Request.QueryString("id")的区别

    获取以表单提交的post类型的值,也就是获取<form method="post">这种方式提交的值request包含各种方式的值,没有指名是什麽,所以Request. ...

  5. 第三方知乎专栏应用Android源码

    这是一个国内开发者白瓦力贡献的一个简约的第三方知乎客户端,也许完整度不太高,但感觉还是相当不错的,其实我也是一个知乎迷,尽管平时围观的比较多. 我相信很多搞安卓开发的童鞋也去过知乎解惑吧.引用作者的描 ...

  6. zabbix3.0.4 部署之八 (zabbix3.0.4 报警前端配置)

    (如何让报警信息推送----微信.邮件)(邮件与微信一样就不在重复) 创建一个用户 将用户加入administrator组 添加之前设置的报警媒介脚本 设置报警等级 创建动作 配置报警内容 设置报警条 ...

  7. iTOP-6818开发板设置NFS共享目录的实现

    NFS 共享目录的制作过程.主要分为两个步骤:1.搭建 NFS 服务器2.配置内核. NFS 是 Network FileSystem 的缩写,是由 SUN 公司研制的 UNIX 表示层协议(pres ...

  8. 5-Java-C(单位分数)

    题目描述: 形如:1/a 的分数称为单位分数. 可以把1分解为若干个互不相同的单位分数之和. 例如: 1 = 1/2 + 1/3 + 1/9 + 1/18 1 = 1/2 + 1/3 + 1/10 + ...

  9. COPY - 在表和文件之间拷贝数据

    SYNOPSIS COPY tablename [ ( column [, ...] ) ] FROM { 'filename' | STDIN } [ [ WITH ] [ BINARY ] [ O ...

  10. mysql5大引擎之间的区别和优劣之分

    数据库引擎介绍 MySQL数据库引擎取决于MySQL在安装的时候是如何被编译的.要添加一个新的引擎,就必须重新编译MYSQL.在缺省情况下,MYSQL支持三个引擎:ISAM.MYISAM和HEAP.另 ...