计算a^b-b^a
View Code
import java.util.*;
import java.math.*;
public class Solution {
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
BigInteger x =BigInteger.valueOf(a);
BigInteger y =BigInteger.valueOf(b);
x=x.pow(b);
y=y.pow(a);
System.out.println(x.subtract(y));
}
}