http://120.78.162.102/problem.php?cid=1432&pid=11

http://120.78.162.102/problem.php?id=6249

题解:

参考文章:

https://blog.csdn.net/arrowlll/article/details/52629448 

https://blog.csdn.net/weixin_43272781/article/details/85311412

快速幂+快速组合数

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
typedef __int128 lll;
const int N=50000+10;
const lll MOD=(1ll<<61)-1;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
lll Jc[N];
void print(lll x){
    if(x==0)
        return;
    print(x/10);
    int tmp=x%10;
    printf("%d",tmp);
}
void calJc(){    //求maxn以内的数的阶乘
    Jc[0] = Jc[1] = 1;
    for(lll i = 2; i < N; i++){
        Jc[i] = Jc[i - 1] * i %MOD;
    }
}
lll PowerMod(lll a, lll b,lll c){
    lll ans = 1;
        a = a % c;
    while(b>0){
        if(b % 2 == 1)
            ans = (ans * a) % c;
        b >>= 1;
        a = (a * a) % c;
    }
    return ans;
}
lll niYuan(lll a, lll b){   //费马小定理求逆元
    return PowerMod(a, b - 2, b);
}

lll C(ll a, ll b){    //计算C(a, b)
    return Jc[a] * niYuan(Jc[b]*Jc[a - b]% MOD, MOD) % MOD;
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    calJc();
    int k,p,q,a,b;
    while(scanf("%d%d%d%d%d",&p,&q,&k,&a,&b)!=EOF){
        print((C(k, a)*(PowerMod(p,a,MOD)*PowerMod(q,b,MOD)%MOD))%MOD);
        printf("\n");
    }
    //cout << "Hello world!" << endl;
    return 0;
}