BZOJ3197 & 组合乱搞
Description
求\[\sum_{i = 1}^{n}i^m m^i , m \leq 1000 \] 的值.
Solution
From Miskcoo's Space:
设 \begin{eqnarray*} f(i) = \sum_{k=1}^n k^i \cdot m^k \end{eqnarray*} 则我们要求$f(m)$.
所谓的"扰动法":
\[\begin{split}
(m-1)f(i) &= m \cdot \sum_{k = 1}^{n} k^i m^k - \sum_{k = 1}^{n}k^i m^k \\
&= \sum_{i=1} ^ {n+1} (k-1)^i m^k - \sum_{k = 1}^{n}k^i m^k \\
&= n^i m^{n+1} + \sum_{k = 1} ^n m^k \sum_{j = 0}^{i-1} {i \choose j} \cdot (-1)^{i - j} \cdot k^j \\
&= n^i \cdot m^{n + 1} + \sum_{j = 0}^{i - 1} {i \choose j} \cdot (-1)^{i - j} \sum_{k = 1}^n k^j \cdot m^k \\
&= n^i \cdot m^{n + 1} + \sum_{j = 0}^{i - 1} {i \choose j} \cdot (-1)^{i - j} \cdot f(j) \\
\end{split}\]
然后就变成了一个递推的问题.
基本思路是什么呢?从已知到未知,观察式子的特征进行转化来简化运算.但是自己什么时候才能把和式变换得这么溜呢....