AC了
2024-06-29 14:13:56
发布于:浙江
13阅读
0回复
0点赞
include <bits/stdc++.h>
using namespace std;
const int M = 10007;
long long c[1005][1005];
long long pow(long long x, long long y){//快速幂,快速求出x^y
if(y == 0){
return 1;
}
long long tmp = pow(x, y / 2) % M;
if(y % 2 == 0){
return tmp%M * tmp%M;
} else {
return tmp * tmp % M * x;
}
}
int main(){
long long a, b, k, n, m;
cin >> a >> b >> k >> n >> m;
c[0][0] = c[1][0] = c[1][1] = 1;
for(int i = 2; i <= k; i++){
for(int j = 0; j <= i; j++){
if(j == 0){
c[i][j] = 1;
} else {
c[i][j] = (c[i-1][j] + c[i-1][j-1]) % M;
}
}
}
cout << c[k][n] * pow(a, n) % M * pow(b, m) % M;
return 0;
}
这里空空如也
有帮助,赞一个