标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1417 Accepted Submission(s): 733
#include<stdio.h> #include<string.h> #include <iostream> #include <algorithm> using namespace std; typedef long long LL; const LL mod = 1000000007; LL f[105]; int main() { f[1] =0,f[2]=1; for(int i=3;i<=100;i++){ f[i] = (f[i-1]+f[i-2])%mod*(i-1)%mod; } int tcase; scanf("%d",&tcase); while(tcase--){ int n; scanf("%d",&n); printf("%lld\n",f[n]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5620608.html