HDU - 1085 母函数】的更多相关文章

年轻人的第一道母函数入门题 #include<bits/stdc++.h> using namespace std; const int maxn = 1000+2000+5000+1; #define rep(i,j,k) for(int i = j; i <= k; i++) #define rep2(i,j,k) for(int i = j; i <= k; i+=2) #define rep3(i,j,k) for(int i = j; i <= k; i+=5) i…
///hdu 1028 母函数 一个数有几种相加方式 #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> #define INF 1000000009 using namespace std; ; int c1[_max], c2[_max]; int main() { int n,i,j,k; while(cin>>n) { ;i<=n;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[]保存第…
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…
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…
有num1个 1 ,num2个 2 ,num3个 5问它们不能组成的最小正整数是谁 样例的母函数 (1+X)(1+X2)(1+X5+X10+X15)展开后 X4的系数为0 Sample Input1 1 30 0 0 Sample Output4 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <string>…
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…
//给你面值为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): 21240    Accepted Submission(s): 9420 Problem Description We all know that Bin-Laden is a notorious terrorist, and he h…