标签:style blog http color os width
1 #include <map> 2 #include <set> 3 #include <list> 4 #include <cmath> 5 #include<cctype> 6 #include <ctime> 7 #include <deque> 8 #include <stack> 9 #include <queue> 10 #include <cstdio> 11 #include <string> 12 #include <vector> 13 #include<climits> 14 #include <cstdlib> 15 #include <cstring> 16 #include <iostream> 17 #include <algorithm> 18 #define LL long long 19 #define PI 3.1415926535897932626 20 using namespace std; 21 int gcd(int a, int b) {return a % b == 0 ? b : gcd(b, a % b);} 22 #define MAXN 1000005 23 #define MOD 1000000007 24 LL ans[MAXN],tmp[MAXN]; 25 void init() 26 { 27 ans[1]=1;ans[2]=1; 28 for (int i=3;i<MAXN;i++) 29 { 30 ans[i]=((i-1)*ans[i-1])+(i-2)*ans[i-2]; 31 ans[i]%=MOD; 32 } 33 } 34 int main() 35 { 36 init(); 37 int T;int kase=1; 38 scanf("%d",&T); 39 while (T--) 40 { 41 int N; 42 scanf("%d",&N); 43 printf("Case %d: %lld\n",kase++,ans[N]); 44 } 45 return 0; 46 }
标签:style blog http color os width
原文地址:http://www.cnblogs.com/qscqesze/p/3861467.html