高精度——sgu112

计算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));


}
}

  

原文地址:https://www.cnblogs.com/huhuuu/p/2171743.html