求最后三位数值 (100/100 分数)
题目描述
求最后三位数值
输入描述
输入整数n, a,1<=n, a<=10000
输出描述
n的a次方的最后三位数值,忽略前缀0
样例输入
14 5
样例输出
824
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int res = 1;
int x, y;
cin >> x >> y;
for (int i=0;i<y;i++)
{
res = res*x;//循环求乘积
res = res%1000;//控制结果小于等于三位数
}
printf("%d",res);
return 0;
}