(#include <bits/stdc++.h> using namespace std; typedef int ll; inline ll read() { ll s=0; bool f=0; char ch=' '; while(!isdigit(ch)) { f|=(ch=='-'); ch=getchar(); } while(isdigit(ch)) { s=(s<<3)+(s<<1)+(ch^48); ch=getchar(); } return (f)?(-s):(s); } #define R(x) x=read() inline void write(ll x) { if(x<0) { putchar('-'); x=-x; } if(x<10) { putchar(x+'0'); return; } write(x/10); putchar((x%10)+'0'); return; } #define W(x) write(x),putchar(' ') #define Wl(x) write(x),putchar('\n') const int Mod=10007; const int N=1005; ll Jiec[N]; inline ll Ksm(ll x,ll y) { x%=Mod; ll ans=1; while(y) { if(y&1) ans=ansx%Mod; x=xx%Mod; y>>=1; } return ans; } inline ll C(ll n,ll m) { return Jiec[n]Ksm(Jiec[m],Mod-2)%ModKsm(Jiec[n-m],Mod-2)%Mod; } int main() { int i,j; int a,b,k,n,m; R(a); R(b); R(k); R(n); R(m); Jiec[0]=1; for(i=1;i<=k;i++) Jiec[i]=Jiec[i-1]*i%Mod; Wl(Ksm(a,n)Ksm(b,m)%ModC(n+m,n)%Mod); return 0; })
共 2 条回复
(#include <bits/stdc++.h> using namespace std; typedef int ll; inline ll read() { ll s=0; bool f=0; char ch=' '; while(!isdigit(ch)) { f|=(ch=='-'); ch=getchar(); } while(isdigit(ch)) { s=(s<<3)+(s<<1)+(ch^48); ch=getchar(); } return (f)?(-s):(s); } #define R(x) x=read() inline void write(ll x) { if(x<0) { putchar('-'); x=-x; } if(x<10) { putchar(x+'0'); return; } write(x/10); putchar((x%10)+'0'); return; } #define W(x) write(x),putchar(' ') #define Wl(x) write(x),putchar('\n') const int Mod=10007; const int N=1005; ll Jiec[N]; inline ll Ksm(ll x,ll y) { x%=Mod; ll ans=1; while(y) { if(y&1) ans=ansx%Mod; x=xx%Mod; y>>=1; } return ans; } inline ll C(ll n,ll m) { return Jiec[n]Ksm(Jiec[m],Mod-2)%ModKsm(Jiec[n-m],Mod-2)%Mod; } int main() { int i,j; int a,b,k,n,m; R(a); R(b); R(k); R(n); R(m); Jiec[0]=1; for(i=1;i<=k;i++) Jiec[i]=Jiec[i-1]*i%Mod; Wl(Ksm(a,n)Ksm(b,m)%ModC(n+m,n)%Mod); return 0; })