标签:++i can include out string ons void pre c++
code:
#include <bits/stdc++.h> #define N 10005 #define LL long long using namespace std; const LL mod=1000000007; void setIO(string s) { string in=s+".in"; string out=s+".out"; freopen(in.c_str(),"r",stdin); } int a[N]; LL fac[N],inv[N],f[N],g[N]; LL qpow(LL x,LL y) { LL tmp=1ll; for(;y;y>>=1,x=x*x%mod) if(y&1) tmp=tmp*x%mod; return tmp; } LL Inv(LL x) { return qpow(x,mod-2); } LL C(int x,int y) { return fac[x]*inv[y]%mod*inv[x-y]%mod; } int main() { // setIO("input"); int i,j,n,m; fac[0]=inv[0]=1ll; for(i=1;i<N;++i) fac[i]=fac[i-1]*1ll*i%mod,inv[i]=Inv(fac[i]); scanf("%d%d",&n,&m); for(i=1;i<=m;++i) scanf("%d",&a[i]); for(i=0;i<=n;++i) { f[i]=C(n,i); for(j=1;j<=m;++j) (f[i]=f[i]*C(a[j]+n-i-1,n-i-1)%mod)%=mod; } for(i=0;i<=n;++i) { (g[0]+=qpow(-1,i)*f[i]%mod+mod)%=mod; } printf("%lld\n",g[0]); return 0; }
标签:++i can include out string ons void pre c++
原文地址:https://www.cnblogs.com/guangheli/p/11734770.html