有一个公式:二项式定理……
然后就没了…..
Code:
#include<iostream>
#include<cstdio>
using namespace std;
const int mod = 10007;
const int maxn = 1000 + 5;
int C[maxn][maxn];
int pow(int a,int b)
{
if(b == 0)return 1;
if(b == 1)return a;
int k = b % 2;
int ans = (pow(a,b/2) * pow(a,b/2)) % mod;
if(k) ans *= a;
ans %= mod;
return ans;
}
int main()
{
//freopen("in.txt","r",stdin);
int a,b,k,n,m;
cin>>a>>b>>k>>n>>m;
for(int i = 1;i <= k;++i)C[i][i] = C[i][0] = 1;
for(int i = 2;i <= k;++i)
for(int j = 1;j < i;++j) C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod;
a %= mod, b %= mod;
int ans = (pow(a,n) * pow(b,m)) % mod;
ans = (ans * C[k][n]) % mod;
printf("%d",ans);
return 0;
}