Holding Bin-Laden Captive!

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

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<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<cstdlib>
#include<string>
#define eps 0.000000001
typedef long long ll;
typedef unsigned long long LL;
using namespace std;
const int N=+;
int a[N];
int c1[N],c2[N];
int main(){
int t[N]={,,,};;
while(scanf("%d%d%d",&a[],&a[],&a[])!=EOF){
if(a[]==&&a[]==&&a[]==)break;
int maxx=a[]*+a[]*+a[]*;
memset(c2,,sizeof(c2));
memset(c1,,sizeof(c1));
for(int i=;i<=a[];i++)c1[i]=;
for(int i=;i<=;i++){
for(int j=;j<=maxx;j++)
for(int k=;k<=a[i]*t[i]&&k+j<=maxx;k=k+t[i]){
c2[j+k]=c2[j+k]+c1[j];
}
for(int j=;j<=maxx;j++){
c1[j]=c2[j];
c2[j]=; }
}
for(int i=;i<=maxx+;i++){
if(c1[i]==){
cout<<i<<endl;
break;
} }
}
}

hdu 1085(普通母函数)的更多相关文章

  1. HDU 1085 Holding Bin-Laden Captive! 活捉本拉登(普通型母函数)

    题意: 有面值分别为1.2.5的硬币,分别有num_1.num_2.num_5个,问不能组成的最小面值是多少?(0<=每种硬币个数<=1000,组成的面值>0) 思路: 母函数解决. ...

  2. HDOJ/HDU 1085 Holding Bin-Laden Captive!(非母函数求解)

    Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...

  3. HDU 1085 Holding Bin-Laden Captive! (母函数)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  4. hdu 1085 有num1个 1 ,num2个 2 ,num3个 5 (母函数)

    有num1个 1 ,num2个 2 ,num3个 5问它们不能组成的最小正整数是谁 样例的母函数 (1+X)(1+X2)(1+X5+X10+X15)展开后 X4的系数为0 Sample Input1 ...

  5. HDU - 1085 母函数

    年轻人的第一道母函数入门题 #include<bits/stdc++.h> using namespace std; const int maxn = 1000+2000+5000+1; ...

  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. hdu 1085 Holding Bin-Laden Captive! (母函数)

    //给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数 //G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3), //展 ...

  8. hdu 1085 给出数量限制的母函数问题 Holding Bin-Laden Captive!

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  9. HDU 1085 Holding Bin-Laden Captive!(DP)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085 解题报告:有1,2,5三种面值的硬币,这三种硬币的数量分别是num_1,num_2,num_5, ...

随机推荐

  1. 5.29 @Value{name}无效时怎么办Could not resolve placeholder ‘name22’ in value “${name22}” 错误解决

    springboot Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder ‘name22’ in ...

  2. 理解list和vector的区别

    原文:http://genwoxuevc.blog.51cto.com/1852984/503337 vector和数组类似,它拥有一段连续的内存空间,并且起始地址不变,因此它能非常好的支持随机存取( ...

  3. vue axios 请求带token设置

    API axios.js import axios from "axios"; let AUTH_TOKEN=(function(){ return localStorage.ge ...

  4. 【转】虚拟化(四):vsphere高可用功能前提-共享存储搭建

    vsphere高级功能HA.DRS.FT等,都需要有共享存储环境,即多台esxi主机同时连接一个共享存储,这样在新建虚拟机时,可以指定把虚拟磁盘保存在共享存储上,便于虚拟机在各个主机之间“飘移”. 常 ...

  5. javaee IO流作业

    package Zy; import java.io.Serializable; public class Student implements Serializable{ private stati ...

  6. day004 与用户交互、格式化输出、基本运算符

    目录 今天Python所学习的知识如下:①与用户的交互.格式化输出.基本运算符.以下整理汇总下所学习的知识点. 与用户的交互 input 注意事项: input函数接受的都是字符串 python2中的 ...

  7. dubbo客户端初始化问题

    背景:工作中遇到了调用dubbo服务的场景,项目不是spring项目,我只想简单的调用服务端的接口,不想加入那么多配置. 在服务对接中,遇到调用dubbo服务的场景.按照公司的框架给的开发文档,要加配 ...

  8. 利用IO多路复用,使用linux下的EpollSelector实现并发服务器

    import socket import selectors # IO多路复用选择器的模块 # 实例化一个和epoll通信的选择器 epoll_selector = selectors.EpollSe ...

  9. 【习题 4-3 UVA - 220】Othello

    [链接] 我是链接,点我呀:) [题意] [题解] legal被我打成leagal... 然后注意输出坐标的时候,格式是%2d.. 然后就没啥难的了.. [代码] #include <bits/ ...

  10. docker 容器操作( 以 tomcat 为例 )

    一.容器操作 一个镜像可以启动多个容器.比如一个 tomcat 镜像,可以启动多个tomcat 容器,启动后的这些 tomcat 都是各自独立的 二.步骤 1.搜索镜像 [root@localhost ...