q-analog,老玩家集体起立!
这也就是说:
\[\binom{n+m}{n}_q=\sum_{\pi\in L_{n,m}}q^{area(\pi)} \]结束!
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7,maxn=2e7+5;
int qp(int a,int b,int p=mod){
int res=1;
while(b){
if(b&1)res=(res*a)%p;
a=(a*a)%p;
b>>=1;
}
return res;
}
int fac[maxn];
int C(int n,int m,int q){
fac[1]=1;int I=qp(q-1,mod-2);
for(int i=2,z=q;i<=n;i++){
z=z*q%mod;
int x=(z-1)*I%mod;
if(q==1)x=i;
fac[i]=fac[i-1]*x%mod;
}
return fac[n]*qp(fac[m],mod-2,mod)%mod*qp(fac[n-m],mod-2,mod)%mod;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int K,ans=0;cin>>K;
for(int i=1;i<=K;i++)(ans+=C((pow(10,i)+i)*2,pow(10,i)+i,i))%=mod;
cout<<ans<<endl;
return 0;
}
标签:int,题解,Project,638,res,fac,Euler,mod
From: https://www.cnblogs.com/british-union/p/18468462