代码
注意若幂本身不足三位,在前面补零
#include<iostream>
#include<iomanip>
using namespace std;
long long res = 1;
int main()
{
int a,b;cin >> a >> b;
while(b)
{
if(b & 1)
{
res = res * a %1000;
}
a = a * a % 1000;
b >>= 1;
}
printf("%03ld",res);
}