题目:https://www.luogu.org/problemnew/show/P1313
a和b输入进来不是<mod的,所以可以爆int。
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N=1005,mod=10007; int a,b,k,n,m,jc[N],jcn[N],c; int pw(int x,int k) { int ret=1;while(k){if(k&1)ret=ret*x%mod;x=x*x%mod;k>>=1;}return ret; } void init() { jc[0]=1; for(int i=1;i<=k;i++)jc[i]=jc[i-1]*i%mod; jcn[k]=pw(jc[k],mod-2); for(int i=k-1;i>=0;i--)jcn[i]=jcn[i+1]*(i+1)%mod; } int main() { scanf("%d%d%d%d%d",&a,&b,&k,&n,&m); init(); c=jc[k]*jcn[n]%mod*jcn[m]%mod; a%=mod; b%=mod; a=pw(a,n); b=pw(b,m); printf("%d ",c*a%mod*b%mod); return 0; }