HDU4535+公式
错排公式。
用64位!
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 /* 2 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 #include<stack> 11 #include<math.h> 12 #include<map> 13 using namespace std; 14 typedef __int64 int64; 15 const int maxn = 1005; 16 const int64 mod = 1000000007; 17 int main(){ 18 int64 a[ 105 ]; 19 //printf("%d\n",mod); 20 a[1] = 0; 21 a[2] = 1; 22 for( int i=3;i<=100;i++ ){ 23 a[ i ] = (i-1)*( a[i-2]+a[i-1] ); 24 a[ i ] %= mod; 25 } 26 int ca; 27 scanf("%d",&ca); 28 while( ca-- ){ 29 int n; 30 scanf("%d",&n); 31 printf("%I64d\n",a[n]); 32 } 33 return 0; 34 }
keep moving...