组合数+错排公式
#include#include using namespace std;#define N 1000001const int mod=1e9+7;long long fac[N],inv[N],f[N];void read(int &x){ x=0; char c=getchar(); while(!isdigit(c)) c=getchar(); while(isdigit(c)) { x=x*10+c-'0'; c=getchar(); }}int Pow(long long a,int b){ long long res=1; for(;b;a=a*a%mod,b>>=1) if(b&1) res=res*a%mod; return res;}int main(){ freopen("permutation.in","r",stdin); freopen("permutation.out","w",stdout); fac[0]=fac[1]=1; for(int i=1;i