hdu_1085_Holding Bin-Laden Captive!_201404261008
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
“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!
#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 ;
}
最新文章
- winform对话框控件、打印控件
- struts2基础篇(1)
- 浏览器浏览记忆(history)几则技巧记录
- golang csv问题
- The first day!!!
- ios9+xcode7 适配笔记
- django中的事务管理
- Andoird 监听开机广播和关机广播
- avg 的使用
- mybatis百科-结果集映射类ResultMap
- 字符集和编码——Unicode(UTF&;UCS)深度历险
- Oracle 故障整理
- bzoj千题计划181:bzoj1878: [SDOI2009]HH的项链
- python 文件 IO 操作
- LinkedHashMap源码剖析
- 十分钟理解Actor模式
- fsync性能问题
- webpack开发模式和生产模式设置及不同环境脚本执行
- Centos7的iso everything与DVD以及Live的区别
- (一)ASP.NET中JavaScript的中英文(多语言)实现方案