题目链接
隐隐约约记得展开式和组合数的关系,但是记不起来,百度了才知道二项式定理。
(
x
+
y
)
n
=
C
(
n
,
0
)
×
x
n
×
y
0
+
C
(
n
,
1
)
×
x
n
−
1
×
y
1
+
C
(
n
,
2
)
×
x
n
−
2
×
y
2
.
.
.
.
.
.
+
C
(
n
,
n
)
×
x
0
×
y
n
(x+y)^n=C(n,0)\times x^n \times y^0+C(n,1)\times x^{n-1} \times y^1+C(n,2)\times x^{n-2} \times y^2......+C(n,n)\times x^0 \times y^n
(x+y)n=C(n,0)×xn×y0+C(n,1)×xn−1×y1+C(n,2)×xn−2×y2......+C(n,n)×x0×yn
知道二项式定理之后就是一个裸题了
答案就是
C
(
k
,
n
)
×
a
n
×
b
m
C(k,n)\times a^n\times b^m
C(k,n)×an×bm
AC代码:
/*
* @Author: hesorchen
* @Date: 2020-04-14 10:33:26
* @LastEditTime: 2020-06-30 22:12:29
* @Link: https://hesorchen.github.io/
*/
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define endl '\n'
#define PI acos(-1)
#define PB push_back
#define ll long long
#define INF 0x3f3f3f3f
#define mod 10007
#define pll pair<ll, ll>
#define lowbit(abcd) (abcd & (-abcd))
#define max(a, b) ((a > b) ? (a) : (b))
#define min(a, b) ((a < b) ? (a) : (b))
#define IOS \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define FRE \
{ \
freopen("in.txt", "r", stdin); \
freopen("out.txt", "w", stdout); \
}
inline ll read()
{
ll x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
//==============================================================================
ll quick_pow(ll a, ll b)
{
ll res = 1;
while (b)
{
if (b & 1)
res = res * a % mod;
a = a * a % mod;
b /= 2;
}
return res % mod;
}
ll jc[2500];
void init()
{
jc[0] = 1;
for (int i = 1; i < 2345; i++)
jc[i] = jc[i - 1] * i % mod;
}
ll C(ll n, ll m)
{
ll a = n % mod;
ll b = m % mod;
if (a < b)
return 0;
if (a && b)
return jc[a] * quick_pow(jc[b], mod - 2) % mod * quick_pow(jc[a - b], mod - 2) % mod * C(n / mod, m / mod) % mod;
else
return 1;
}
int main()
{
ll a, b, k, n, m;
cin >> a >> b >> k >> n >> m;
init();
cout << C(k, n) * quick_pow(a, n) * quick_pow(b, m) % mod << endl;
return 0;
}
/*
*/