#include <bits/stdc++.h>
using namespace std;
#define LL long long
int qp(LL a, LL b, int mod){
int res = 1;
while(b){
if(b&1) res = res*a%mod;
a = a*a%mod;
b >>= 1;
}
return res;
}
int main(){
int a, b;
while(scanf("%d %d", &a, &b) == 2){
if(a == 0 && b == 0) break;
printf("%d\n", qp(a, b, 1000));
}
return 0;
}
hdu 2035 人见人爱A^B
最新推荐文章于 2022-02-01 12:31:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)