Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16646 Accepted Submission(s): 6935
2 3
1 2
#include<stdio.h> #define LL long long LL f[25]; void init() { f[0]=0; f[1]=0; f[2]=1; for(int i=3;i<=20;i++) { f[i]=(i-1)*(f[i-1]+f[i-2]); } } int main() { int n; init(); while(scanf("%d",&n)!=EOF) { printf("%lld\n",f[n]); } return 0; }
原文地址:http://blog.csdn.net/u010579068/article/details/46539769