HDU/2034/2035/main.c

17 lines
242 B
C
Raw Permalink Normal View History

2020-08-31 16:48:58 +00:00
#include <stdio.h>
int main(void){
int a, b, c = 1000, t = 1;
a = a % c;
while(scanf("%d %d",&a,&b) == 2 && a+b){
t = 1;
while(b != 0){
if(b & 1) t = t * a % c;
b >>= 1;
a = a * a % c;
}
printf("%d\n",t);
}
return 0;
}