hdu 1085 Holding Bin-Laden Captive!】的更多相关文章

Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13861    Accepted Submission(s): 6230 Problem Description We all know that Bin-Laden is a notorious terrorist, and he…
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17653    Accepted Submission(s): 7902 Problem Description We all know that Bin-Laden is a notorious terrorist, and he h…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085 解题报告:有1,2,5三种面值的硬币,这三种硬币的数量分别是num_1,num_2,num_5,问你不能凑的钱的最小值是多少. DP,开一个这样的数组dp[i][3],然后dp[i][0]表示凑成 i 元钱需要dp[i][0]张1块的,需要dp[i][1]张两块的,dp[i][2]张5块的,然后依次往后递推,得到 i 的途径一共有三种,第一种是i-1加一张一块的,第二种是i-2加上1张两块的,…
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 hi…
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 i…
题意: 有面值分别为1.2.5的硬币,分别有num_1.num_2.num_5个,问不能组成的最小面值是多少?(0<=每种硬币个数<=1000,组成的面值>0) 思路: 母函数解决.只有3个括号要作乘法,分别代表面值1.2.5所能组成的情况.需要两个数组,所能组成的最大值为num_1+2*num_2+5*num_5.如果在这个范围内都能组成,那么最小不能组成的面值为num_1+2*num_2+5*num_5+1.若没有1分钱的硬币,那么不能组成的肯定是1了. 数组的用法:ans[]保存第…
生成函数题. 题意:有币值1,2,5的硬币若干,问你最小的不能组成的币值为多少. 解法:写出生成函数: 然后求每项的系数即可. 因为三种硬币最多1000枚,1*1000+2*1000+5*1000=8000,那么多项式乘积的最高次数为8000 用c保存累计相乘各项的系数,tc保存c和当前项相乘的系数 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> us…
//给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数 //G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3), //展开,系数不为0的数都是能够由硬币组合出来的. # include <algorithm> # include <string.h> # include <stdio.h> # include <iostream> using namespace std; int…
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17256    Accepted Submission(s): 7734 Problem Description We all know that Bin-Laden is a notorious terrorist, and he h…
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11583    Accepted Submission(s): 5188 Problem Description We all know that Bin-Laden is a notorious terrorist, and he h…