母函数
柠檬不酸只是萌
遇 见 最 美 的 自 己 。
展开
-
母函数讲解篇
在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。 母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一个母函数。构造母函数的目的一般是为了解决某个特定的问题,因此选用何种母函数视乎序列本身的特性和转载 2016-10-15 13:49:27 · 285 阅读 · 0 评论 -
HDU 1028 —— Ignatius and the Princess III
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1028 #include using namespace std; const int maxn = 250; int arr[maxn], tmp[maxn]; int n; int main(){ while(cin>>n){ for(int i = 0;i<=n;i+原创 2016-10-15 13:51:31 · 269 阅读 · 0 评论 -
HDU 1398 —— Square Coins
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1398 #include using namespace std; const int maxn = 1000; int arr[maxn], tmp[maxn]; int n; int main(){ while(cin>>n){ if(n == 0) break;原创 2016-10-15 13:53:31 · 309 阅读 · 0 评论 -
HDU 1085 —— Holding Bin-Laden Captive!
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1085 #include #include #include using namespace std; const int maxn = 1e4; int dp[maxn], tmp[maxn]; int a, b, c; int main(){ while(cin>>a>>b>>c){原创 2016-10-15 13:55:05 · 223 阅读 · 0 评论 -
HDU 1171 —— Big Event in HDU
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1171 #include #include #include using namespace std; const int maxn = 100; const int maxm = 5e5; int dp[maxm], tmp[maxm]; int val[maxn], num[maxn]; in原创 2016-10-15 13:56:27 · 208 阅读 · 0 评论 -
HDU 2069 —— Coin Change
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2069 思路:需要注意一个条件,组合的硬币数不能超过100。把数组开成二维的,dp[i][j] 表示用 j 个硬币组成 i 的方式有多少种。 #include #include #include const int maxn = 300; using namespace std; int原创 2016-10-15 16:50:03 · 294 阅读 · 0 评论 -
HDU 2152 —— Fruit
原题:http://acm.hdu.edu.cn/showproblem.php?pid=2152 修改一下左右的边界范围 #include #include #include using namespace std; const int maxn = 110; int a[110][2]; int dp[maxn*maxn], tmp[maxn*maxn]; int n, m;原创 2016-10-15 20:24:31 · 309 阅读 · 0 评论