全 部 R E
查看原帖
全 部 R E
338147
01bit楼主2020/9/16 20:12
#include<cstdio>
#define ull unsigned long long
using namespace std;
ull _pow[1000+1][1000+1];
ull pow(ull a,ull b){
    if(_pow[a][b]!=0)return _pow[a][b];
    if(b==0)return 1;
    if(b==1)return a;
    ull temp=pow(a,b>>1);
    temp=temp*temp;
    if(b&1==1)temp=temp*a;
    return _pow[a][b]=temp;
}
ull _jc[1000+1];
ull jc(ull n){
    if(_jc[n]!=0)return _jc[n];
    ull ans=1;
    for(ull i=1;i<=n;i++)ans=ans*i;
    return _jc[n]=ans;
}
ull _C[1000+1][1000+1];
ull C(ull n,ull k){
    if(_C[n][k])return _C[n][k];
    return _C[n][k]=jc(n)/(jc(k)*jc(n-k));
}
int main(){
    ull a,b,k,n,m;
    scanf("%ull%ull%ull%ull%ull",&a,&b,&k,&n,&m);
    printf("%ull",(C(k,m)*pow(a,n)*pow(b,m))%10007);
    return 0;
}
2020/9/16 20:12
加载中...