View Code 1 #include"iost
原创
2021-07-28 16:47:47
54阅读
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 23275 Accepted Submis
转载
2017-09-27 21:06:00
58阅读
1.题目链接。题目大意:给你一定数量的1元,2元,5元的钱,问你最下不能够凑出来的数目是哪一个?2.额,显然是一个组合的问题了。这种选数据的题目,是母函数的最好的使用场所了
原创
2022-07-01 10:33:07
16阅读
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
转载
2016-05-02 22:06:00
32阅读
2评论
http://acm.hdu.edu.cn/showproblem.php?pid=1085Problem DescriptionWe all know that Bin-Laden is a notorious...
转载
2019-05-23 09:52:00
125阅读
2评论
题目Problem DescriptionWe 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 terr...
原创
2021-07-13 13:57:17
135阅读
http://acm.hdu.edu.cn/showproblem.php?pid=1085Problem DescriptionWe all know that Bin-Laden is a notorious...
转载
2019-05-23 09:52:00
93阅读
2评论
列出生成函数的多项式之后暴力乘即可 cpp include include include using namespace std; const int N=20005; int n,x,y,z,a[N],b[N]; int main() { while(scanf("%d%d%d",&x,&y,&
转载
2018-11-26 08:06:00
23阅读
2评论
Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18710 Accepted Submis
原创
2022-09-26 14:31:38
36阅读
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1085 题意:分别给num1,num2,num3个1元,2元,5元硬币,求不能凑出来的最小值分析:母函数 也是打表#include <cstdio>#include <cmath>#include <cstring>#include <iostream>#include <string>#in
原创
2021-07-06 15:14:13
94阅读
题目大意:分别输入面额为1、2、5的硬币的数量。输出这些硬币不能组成的最小金额 解题思路:本题与1028的一个很大的区别就在于他的硬币的个数是固定。 硬币面额1,2,5且有数量限制num
转载
2013-08-09 23:50:00
16阅读
题目大意:分别输入面额为1、2、5的硬币的数量。输出这些硬币不能组成的最小金额解题思路:本题与1028的一个很大的区别就在于他的硬币的个数是固定。硬币面额1,2,5且有数量限制num1,num2,num3,问最小不能组合的数量是多少。G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3),展开,系数不为0的
原创
2013-08-09 15:58:44
67阅读
2011-12-20 02:42:35地址:http://acm.hdu.edu.cn/showproblem.php?pid=1085题意:面额为1、2、5的硬币各有a、b、c枚。问最小的不能由它们组成的面额。mark:不要想复杂了。对于一个给定的面额n,可以用O(1)的贪心办法判断它是否能由题目所给条件的硬币组成。然后从头搜到尾。代码:# include <stdio.h>int a, b, c ;int min(int a, int b){return a<b?a:b;}int test(int n){ n -= 5*min(n/5, c) ; n -= 2*min(n
转载
2012-01-06 22:30:00
37阅读
母函数的应用HDU 1028#include<stdio.h>
#include<string>
using namespace std;
int n,c1[200],c2[200];
int main(){ int i,j,k; while(scanf("%d",&n)!=EOF){ memset(c2,0,sizeof(c2)); for(i=0;i<=n;i++) c1[i]=1; for(i=2;i<=n;i++){ for(j=0;j<=n;j++) for(k=0;k+j<=n;k+=i) c2[k+j]+
转载
2012-04-01 10:58:00
50阅读
2评论
母函数的应用HDU 1028#include#includeusing namespace std;int n,c1[200],c2[200];int main(){ int i,j,k; while(scanf("%d",&n)!=EOF){ mem
原创
2023-09-15 09:42:32
38阅读
HDU_1085
这个题目可以用完全背包问题的思路去解,为了练一下生成函数,我就用生成函数的思路写了一下,构造生成函数G(x)=(1+x+x^2+…+x^n1)(1+x^2+x^4+…+x^(2*n2))(1+x^5+x^25+…+x^(5*n3)),最后按x,x^2…的顺序看哪一项的系数为0即可。
#include<stdio.h>#include<string.h&
转载
2012-03-06 01:15:00
37阅读
2评论
题意: 给A个1元,B个2元,C个5元,问最小的不能拼出的钱是多少 考虑生成函数$G(x)=(1+x+x2+...+xA)(1+x2+x4+...+x^{2B})(1+x5+x10+...+x^{5C})$ 最小的系数为0的项,其指数就是答案 #include<bits/stdc++.h> usin ...
转载
2021-08-04 11:01:00
63阅读
2评论
Holding Bin-Laden Captive!HDU - 1085We all know that Bin-Lade
原创
2023-06-09 14:02:35
47阅读
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
原创
2021-07-29 16:19:16
318阅读
题解: 1.若num_1=0,显然答案为1; 2.若num_1!=0;能产生直到2*num_2+num_1; 的数 3.若2*num_2+num_1>=4,则能产生直到5*num_3+2*num_2+num_i的数#include<stdio.h>int main(){ int a,b,c; while(scanf("%d %d %d",&a,&b,&c)!=EOF&&(a!=0||b!=0||c!=0)) { if(a==0) { printf("1\n"); } else if(2*...
转载
2013-05-30 12:43:00
31阅读