@ZCDHJ
2018-10-02T16:11:35.000000Z
字数 665
阅读 528
组合数学
通过二项式定理可知答案为 。
那么直接计算就行了。
#include <iostream>#include <cstdio>typedef long long LL;#define int LLconst int MOD = 10007;int a, b, k, n, m;inline int read() {register int x = 0;register char ch = getchar();while(!isdigit(ch)) ch = getchar();while(isdigit(ch)) {x = x * 10 + ch - '0';ch = getchar();}return x;}inline int fPow(int x, int y) {int res = 1, base = x;while(y) {if(y & 1) res = res * base % MOD;base = base * base % MOD;y >>= 1;}return res;}inline int C(int x, int y) {int xx = 1, yy = 1;for(int i = y + 1; i <= x; ++i) xx = xx * i % MOD;for(int i = 1; i <= x - y; ++i) yy = yy * i % MOD;return xx * fPow(yy, MOD - 2) % MOD;}signed main() {a = read();b = read();k = read();n = read();m = read();printf("%lld\n", C(k, n) * fPow(a, n) * fPow(b, m) % MOD);return 0;}
