[Template] generating function

For example, we have a sequence {1,6,4,8,5}, we consider a function that represents the number of columns.

\(g(x)\)=\(1\)+\(6x^1\)+\(4x^2\)+\(8x^3\)+\(5x^4\)

In this function, the number of coefficients of each of the several columns, each of the unknowns \ (X \) index \ (I \) represents a coefficient which is the number of columns of the original \ (i + 1 \ ) item.
So what can this do?
He can ask a question similar type of backpack.
For example:

有A,B两种物品,A种物品至多取2个,B种物品的取得个数必须是5的倍数。请问A,B两种物品的个数加起来的数量为n的方案数。

The answer is a function of:

\(g(x)\)=\((1+x^1+x^2)\)\((1+x^5+x^{10}...)\)

Q: What was the first item of this function is n?
Obviously this function can be FFT.
However, the \ (- 1 <x <1 \) polynomials can be simplified when.
For example:
The first direct polynomial geometric series summation.

\(1+x^k+x^{2k}+...+x^{(n-1)k}\)=\(\frac{1-x^{n}}{1-x^k}\)

The second can be simplified.

\(1+x^5+x^{10}...\)=\(\frac{1}{1-x^5}\)

This equation was originally \ (\ frac {-X ^. 1. 5. 1-n-X} ^ {} \) , n-larger, \ (n-X ^ \) to infinitely approaches zero, it is \ (\ frac { 1} {1-x ^ 5 } \)

General generating function template title is simplification finished, the rest of \ (\ FRAC {1} {(1-the X-) ^ k} \) , then the formula into what can it?

In fact, this is the \ (K \) a \ (\ frac {1} { 1-x} \) is multiplied, i.e. \ (K \) a \ ((1 + x ^ 1 + x ^ 2 ...) \) multiplied by card method, the index i is the coefficient of the term \ ({C_-i + K}. 1. 1-K ^ {} \) .

Recommended Title:
[] Triple BZOJ3771
Luo Gu P2000 save the world

Guess you like

Origin www.cnblogs.com/2017gdgzoi44/p/11485557.html