标签:
#include<iostream> #include<vector> #include<map> #include<string> using namespace std; __int64 res[1000005]; void init() { __int64 i,j,tmp; res[1]=1; res[2]=2; for(i=3;i<1000005;i++) { tmp=(i-1)*res[i-2]; tmp%=1000000007; res[i]=res[i-1]+tmp; res[i]%=1000000007; } } int main() { int T,N; int i,j; init(); cin>>T; for(i=1;i<=T;i++) { cin>>N; cout<<"Case #"<<i<<":"<<endl; printf("%ld\n",res[N]);; } return 0; }
标签:
原文地址:http://blog.csdn.net/wljwsj/article/details/45949909