题目连接
#include<algorithm> #include<iostream> #include<cstring> #include<cstdio> #include<cctype> #define ll long long #define gc getchar #define maxn 1005 #define mo 10007 using namespace std; inline ll read() { ll a=0;int f=0;char p=gc(); while(!isdigit(p)){f|=p=='-';p=gc();} while(isdigit(p)){a=(a<<3)+(a<<1)+(p^48);p=gc();} return f?-a:a; } int n,m,k,a,b,f[maxn][maxn]; int pow(int a,int k) { int ans=1; while(k) { if(k&1)ans=ans*a%mo; a=a*a%mo;k>>=1; } return ans; } int main() { f[0][0]=1; a=read()%mo;b=read()%mo;k=read();n=read();m=read(); for(int i=1;i<=k;++i) { f[i][0]=1; for(int j=1;j<=i;++j) f[i][j]=(f[i-1][j-1]+f[i-1][j])%mo; } printf("%d ",f[k][n]*pow(a,n)%mo*pow(b,m)%mo); return 0; }
同样by子谦。(是HMY,不是钟子谦奆佬QWQ)大佬的面对面讲解
原谅我大括号换行。。。