GaoGao次

来源:互联网 发布:树莓派网络设置 编辑:程序博客网 时间:2024/04/29 06:35

#include<stdio.h>
int main()
{
int i,x,y,last=1; /*变量last保存求X的Y次方过程中的部分乘积的后三位*/
scanf("%d%d",&x,&y);
for(i=1;i<=y;i++) /*X自乘Y次*/
last=last*x%1000; /*将last乘X后对1000取模,即求积的后三位*/

 


if (last%1000<10)
printf("00%d",last%1000); /*打印结果*/
else if(last%1000<100)
printf("0%d",last%1000); /*打印结果*/
else
printf("%d",last%1000);


return 0;

}

 

0 0
原创粉丝点击