//2035 人见人爱A^B
#include <iostream>
#include <string>
using namespace std;
void func(int a, int b)
{
int res = 1;
for (int i = 1; i <= b; i++)
{
res = res * a;
}
// res*=a;
// res%=1000;
//下面想复杂了,每次乘完模上1000就行
string s;
s = to_string(res);
if (s.size() <= 3)
cout << s;
else
{
for (int i = s.size() - 3, j = 1; j <= 3; j++, i++)
cout << s[i] - '0';
}
cout << endl;
}
int main()
{
int a, b;
while (cin >> a >> b && (a || b))
{
func(a, b);
}
return 0;
}
hdu 2035 人见人爱A^B
于 2023-03-14 17:27:13 首次发布