A hard puzzle添加链接描述
#include <stdio.h>
int main() {
int a, b, d, i;
while (scanf("%d%d", &a, &b)==2) {
a %= 10000;
b %= 10000;
d = 1;
for (i = 1; i <= b; i++) {
d *= a;
d %= 10000;
}
printf("%d\n", d%10);
}
return 0;
}