In mathematics you don't understand things, you just get used to them.

link。Lagrange Interpolation。朴素的 dp 即设 $f_i(j)$ 表示前 $i$ 个位置,最大值为 $j$,位置 $i$ 可选可不选的方案数,转移即 $\displa...

设 $dp_x$ 为从 $x$ 走出去的期望步数,可以写出转移 $\displaystyle dp_x = k_x \cdot dp_1 + e_x \cdot 0 + (1 - k_x - e...