生成函数的背包计数问题

鏼爷的冬令营课件

核猩公式

\[\ln (1+x)=x-\frac{1}{2}x^2+\frac{1}{3}x^3-\frac{1}{4}x^4+...\]

版本1

\[ \begin{aligned} \prod_{i=1}^{n}(1+x^i+x^{2i}+...)^{a_i}=&\prod_{i=1}^{n}(\frac{1}{1-x^i})^{a_i}\\ =&\exp(\sum_{i=1}^{n}-a_i\ln(1-x^i))\\ =&\exp(\sum_{i=1}^{n}a_i\sum_{j=1}^{+\infty}\frac{x^{ij}}{j})\ (其实感觉推到这步就能做了的说)\\ =&\exp(\sum_{j=1}^{+\infty}\frac{1}{j}\sum_{i=1}^{n}a_ix^{ij})\\ =&\exp(\sum_{j=1}^{+\infty}\frac{1}{j}A(x^j)) \end{aligned} \]

可以\(A(x)\)有用的项一共只有\(\sum_{i=1}^{n}\lfloor\frac{n}{i}\rfloor=O(n \log n)\)项。

版本2

\[ \begin{aligned} \prod_{i=1}^{n}(1+x^i)^{a_i}=&\exp(\sum_{i=1}^{n}a_i\ln(1+x^i))\\ =&\exp(\sum_{i=1}^{n}a_i\sum_{j=1}^{+\infty}(-1)^{j+1}\frac{x^{ij}}{j})\\ =&\exp(\sum_{j=1}^{+\infty}\frac{(-1)^{j+1}}{j}\sum_{i=1}^{n}a_ix^{ij})\\ =&\exp(\sum_{j=1}^{+\infty}\frac{(-1)^{j+1}}{j}A(x^j)) \end{aligned} \]

版本3

\[ \begin{aligned} \prod_{i=1}^{n}(1+x^i+x^{2i}+...+x^{a_ii})=&\prod_{i=1}^{n}\frac{1-x^{a_ii}}{1-x^i}\\ =&\exp(\sum_{i=1}^{n}(\ln(1-x^{a_ii})-\ln(1-x^i)))\\ =&\exp(\sum_{i=1}^{n}(\sum_{j=1}^{+\infty}\frac{x^{ij}}{j})-(\sum_{j=1}^{+\infty}\frac{x^{a_iij}}{j})) \end{aligned} \]

posted on 2019-05-09 15:25 ErkkiErkko 阅读(...) 评论(...) 编辑 收藏

统计