摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2068此题考查错排公式,组合数运算,正确的数目用组合,错误的情况用错排。错排公式为:F(n)=(n-1)*(F(n-1)+F(n-2));F(1)=0;F(2)=1;……AC 代码为:#include<iostream>using namespace std;__int64 a[13]={0,0,1};//只需要定义到a[13]即可,因为最大为25void fun(){ for(int i=3;i<=12;i++) a[i]=(i-1)*(a[i-1]+a[i-2]); }in.. 阅读全文
posted @ 2012-05-04 18:58 龙杉老师 阅读(404) 评论(0) 推荐(0)