计算a的b次方的个位数

import java.math.BigInteger;
import java.util.Scanner;


public class P2574 {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while (cin.hasNext()) {
BigInteger a = cin.nextBigInteger();
BigInteger b = cin.nextBigInteger();
BigInteger c = BigInteger.valueOf(10);
System.out.println(a.pow(b.intValue()).remainder(c));
}
}
}

猜你喜欢

转载自blog.csdn.net/progammer10086/article/details/80986125