17028djwcb
17028djwcb
⭐️难度:中等
🌟考点:思维、高精度
📖
📚
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
BigInteger k = new BigInteger("10");
while(t-->0){
BigInteger x = new BigInteger(sc.next());
BigInteger p = new BigInteger(sc.next());
System.out.println(x.modPow(p, k));
}
}
}
直接通过BigInteger的快速快速幂取模modPow