雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

高精度——sgu112

Posted on 2011-09-08 18:49  huhuuu  阅读(222)  评论(0编辑  收藏  举报
计算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));


}
}