hdu 1465错排

http://acm.hdu.edu.cn/showproblem.php?pid=1465

code:

#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
	__int64 f[25];
	f[2]=1;
	f[3]=2;
	int i;
	for(i=4;i<=20;i++)
	{
		f[i]=(i-1)*(f[i-1]+f[i-2]); 
	}
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		cout<<f[n]<<endl;
	}
	return 0;
}



你可能感兴趣的:(hdu 1465错排)