hdoj 1085 Holding Bin-Laden Captive! <思维>

来源:互联网 发布:数据审计追踪 编辑:程序博客网 时间:2024/06/06 00:59

Holding Bin-Laden Captive!

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


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 30 0 0
 

Sample Output
4
 

Author
lcy



代码:

#include<cstdio>#define MA 9000bool fafe[MA];int shu[MA],ge;int main(){    int a,b,c;    while (scanf("%d%d%d",&a,&b,&c),a+b+c)    {        if (a==0)        {            printf("1\n");            continue;        }        int kp=a+2*b+1;        for (int i=0;i<kp;i++)            shu[i]=1;        if (kp<5)        {            printf("%d\n",kp);        }        else            printf("%d\n",kp+c*5);    }    return 0;}


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 淘宝顾客反应没赠品怎么办 淘宝上买东西赠品不给怎么办 天猫店关了质量有问题怎么办 蘑菇街开店被骗了怎么办 百视通网络机顶盒恢复出厂后怎么办 王牌电视出现无信号怎么办 联通电视串台了怎么办 电视上出现系统更新怎么办 电视开机一直在更新怎么办 云视听极光闪退怎么办 不小心打错电话怎么办 相亲发信息不回怎么办 如果一个人微信不回电话不接怎么办 跟老公吵架打电话不接怎么办 起诉离婚对方不接电话怎么办 苹果手机接电话声音小怎么办 老公不回你微信怎么办 工地欠货款不给怎么办 朋友微信借钱不还怎么办 微信上借钱不还怎么办 微信借钱不还怎么办 微信转账借钱不还怎么办 没欠条人家欠钱不给怎么办 欠货款被告没去怎么办 别人欠我钱不接电话怎么办 借给别人钱不接电话怎么办 欠钱的人玩消失怎么办 被婚介所骗了5万怎么办 贷款紧急联系人被骚扰怎么办 微信限制加好友怎么办 珍爱网的客服老打电话怎么办 百合网的人气是怎么办 苹果x来电不显示怎么办 苹果8黑屏没反应怎么办 苹果六s开不了机怎么办 苹果6s突然黑屏怎么办 苹果6s黑屏了怎么办 苹果6s手机黑屏打不开怎么办 苹果6sp手机死机怎么办 苹果6s打不开机怎么办 6s开不了机怎么办