随笔分类 -  母函数

摘要:Big Event in HDUProblem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 2002.The splitting is absolutely a big event in HDU! At the same time 阅读全文
posted @ 2012-04-18 22:00 龙杉老师
摘要:Holding Bin-Laden Captive!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. 阅读全文
posted @ 2012-04-18 19:20 龙杉老师
摘要:Square CoinsProblem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available i 阅读全文
posted @ 2012-04-18 15:53 龙杉老师
摘要:排列组合Problem Description有n种物品,并且知道每种物品的数量。要求从中选出m件物品的排列数。例如有两种物品A,B,并且数量都是1,从中选2件物品,则排列有"AB","BA"两种。Input每组输入数据有两行,第一行是二个数n,m(1<=m,n<=10),表示物品数,第二行有n个数,分别表示这n件物品的数量。Output对应每组数据输出排列数。(任何运算不会超出2^31的范围)Sample Input2 2 1 1Sample Output2解:指数型母函数的应用#include<iostream>#includ 阅读全文
posted @ 2012-04-18 09:35 龙杉老师
摘要:母函数分为:普通型母函数,指数型母函数。普通型母函数主要是来求组合的方案数,而指数型母函数是求多重排列数。关于普通型母函数的讲解,以前写过:http://www.cnblogs.com/hsqdboke/archive/2012/04/17/2453677.html指数型母函数主要是关于排列组合方面的问题。分别看两个比较典型的问题对比:普通母函数问题:有红球两个,白球、黄球各一个,试求有多少种不同的组合方案。指数型母函数问题:假设有8个元素,其中a1重复3次,a2重复2次,a3重复3次。从中取r个组合,求其排列数。下面是指数型母函数的定义:对于上面的问题“假设有8个元素,其中a1重复3次,a2 阅读全文
posted @ 2012-04-17 20:58 龙杉老师
摘要:Ignatius and the Princess IIIProblem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:N=a[1]+a[2]+a[3]+...+a[m];a[i]>0,1<=m 阅读全文
posted @ 2012-04-17 20:08 龙杉老师
摘要:母函数详解在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一个母函数。构造母函数的目的一般是为了解决某个特定的问题,因此选用何种母函数视乎序列本身的特性和问题的类型。这里先给出两句话,不懂的可以等看完这篇文章再回过头来看:1.“把组合问题的加法法则和幂级数的乘幂对应起来”2.“母函数的思想很简单 — 就... 阅读全文
posted @ 2012-04-17 15:04 龙杉老师