hdu 1085 Holding Bin-Laden Captive!
来源:互联网 发布:淘宝客服挂起 编辑:程序博客网 时间:2024/05/16 15:42
Holding Bin-Laden Captive!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11989 Accepted Submission(s): 5362
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!
“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#include<cstdio>#include<string.h>#include<iostream>#include<algorithm>using namespace std;int main(){ int money,i,p1,p2,p5,n1,n2,n5,vis[8000]; while(scanf("%d %d %d",&p1,&p2,&p5),p1,p2,p5) { memset(vis,0,sizeof(vis)); for(i=1;i<=8000;i++) { money=i; n5=money/5; if(n5<=p5)money-=n5*5; else money-=p5*5;//能用5的用5 n2=money/2; if(n2<=p2)money-=n2*2; else money-=p2*2;//能用2的用2 n1=money/1; if(n1<=p1)money-=n1*1; else money-=p1*1; if(money!=0) break; } printf("%d\n",i); }}
- hdu 1085 Holding Bin-Laden Captive!
- HDU 1085 - Holding Bin-Laden Captive!
- HDU 1085 Holding Bin-Laden Captive!
- HDU 1085 Holding Bin-Laden Captive
- HDU 1085 Holding Bin-Laden Captive!
- Hdu 1085 - Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- Holding Bin-Laden Captive! hdu 1085
- hdu/hdoj 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- hdu 1085 Holding Bin-Laden Captive!
- HDU 1085 Holding Bin-Laden Captive!
- 关于Ant工具的配置和使用
- 拓扑排序
- GDI绘画自定(定义字数、多行文字、矩形、C#编程素描^_^)
- Edge-Avoiding Wavelets and their Applications
- WebLogic10安装图文教程
- hdu 1085 Holding Bin-Laden Captive!
- Flex中如何通过showCloseButton属性控制TitleWindow右上角关闭按钮有效/无效的例子
- oracle中spool将查询的数据写入文件
- android4.0增加遥控器按键步骤
- Dijkstra 算法总结
- POJ2402+模拟
- js 鼠标右键事件
- mysql的grant权限
- 调用WebService实例