考虑 DP. 状态 令 $f[\ell][x]$ 表示长度为 $\ell$,首项不超过 $x$ 的序列的个数. 答案是 $f[K][N]$. 有递推 $f[\ell][x] = f[\ell][x - 1] + f[\ell - 1][\floor{N/x}]$.照这个递推式求解,复杂度度太高:把它改成 $f[\ell][x] = \sum_{y = 1}^{x} f[\ell - 1][\floor{N/y}]$ 也就是枚举首项. 我们的目标是求出 $f[K][N]$,结合递推式来看,可以发现…