hdu 6063 RXD and math
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const ll mod=1e9+7; 5 6 ll hh(ll x,ll y){ 7 ll s=1; 8 while(y){ 9 if(y&1) s=s*x%mod; 10 x=x*x%mod; 11 y>>=1; 12 } 13 return s; 14 } 15 int main(){ 16 int k=1; 17 ll n,m; 18 while(scanf("%lld%lld",&n,&m)!=EOF){ 19 n%=mod; 20 printf("Case #%d: %lld\n",k++,hh(n,m)); 21 } 22 }