#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll m=1000000000;
ll binaryPow(ll a,ll b,ll m){
ll ans=1;
while(b>0){
if(b&1){ //判断奇偶
ans=ans*a%m;
}
a=a*a%m;
b>>=1;
}
return ans;
}
int main(){
ll a,b;
while(cin>>a>>b){
ll t=binaryPow(a,b,m);
int temp[3]={0};
for(int i=0;i<3;i++){
temp[i]=t%10;
t/=10;
}
for(int i=2;i>=0;i--){
cout<<temp[i];
}
cout<<endl;
}
return 0;
}
问题 B: ACM数学专题: 幂(47th)
最新推荐文章于 2020-10-06 10:01:46 发布