有限背包计数问题有无比 O(N√N) 更优的做法

学术版

插眼,感觉没有,有了踢我
by yinianxingkong @ 2024-04-19 10:53:15


https://www.51nod.com/Challenge/Problem.html#problemId=1597 这道题
by Pentiment @ 2024-04-19 10:57:18


oies 上给出的生成函数感觉不太可实行
by Pentiment @ 2024-04-19 10:57:56


@[Run_Time_Error](/user/879904) 是的
by s_c_m @ 2024-04-19 11:00:32


@[Run_Time_Error](/user/879904) 可以使用类似 https://www.luogu.com.cn/problem/P4389 的技巧做到 $O(n\log n)$ 不过对这道题来说由于模数原因大概需要一些 dirty work.(尤其是23333333=17*1372549,可能需要再mod 17^k的意义下做ln和exp).
by Killer_joke @ 2024-04-19 11:39:53


@[Killer_joke](/user/915814) thx.
by Pentiment @ 2024-04-19 11:42:43


@[Killer_joke](/user/915814) 这个怎么算啊,求求,教教,它的式子不是 $\prod \frac{x^{i(i+1)-1}}{x^i-1}$?
by win114514 @ 2024-04-19 14:23:27


@[win114514](/user/1067102) 转换一下就是 $\prod {\frac{1-x^{i(i+1)}}{1-x^i}}$ 然后考虑求取这个东西的对数,调和级数不难做到 $O(n\log n)$ 再做exp即可.
by Killer_joke @ 2024-04-19 14:24:59


|