CTP314 / CTP314.github.io

CTP_314的博客
1 stars 0 forks source link

72709102 AGC005 | CTime_Pup_314 #47

Open CTP314 opened 5 years ago

CTP314 commented 5 years ago

https://ctp314.github.io/2019/07/27/72709102-AGC005/#more

~K Perm Counting 如果一个排列 $P$ 满足对于所有的i都有 $|p_i-i|\ne k$,则称排列P为合法的,求合法排列数 考虑错排问题就是 $k\ = 0$ 的特殊情况,这道题用同样做法来做,设 $f_i$ 为恰好有 $i$ 个满足 $|p_i-i|\ne k$ 的方案数,$g_i$ 为至少有 $i$ 个满足 $|p_i-i|\ne k$ 的方案数,则有 $$g_i\ =\