N wizards are attending a meeting. Everyone has his own magic wand. N magic wands was put in a line, numbered from 1 to n(Wand_i owned by wizard_i). After the meeting, n wizards will take a wand one by one in the order of 1 to n. A boring wizard deci…
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2282 编号1~n的置换,不动点个数大于等于k的方案数. 参考百度百科错排公式,可以知道长度为n,每个数都不在自己位置的方案数.然后枚举长度即可. 考虑对立面(即小于k个在自己位置的)可以优化空间. #include<cstdio> #include<algorithm> using namespace std; ; ; int D[maxn]; ]; int F[maxn]; int main…