SGU 112 a^b b^a

SGU_112

    用Java的BigInteger很容易实现。

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

public class Solution {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int a, b;
while(cin.hasNext())
{
a = cin.nextInt();
b = cin.nextInt();
System.out.println(BigInteger.valueOf(a).pow(b).add(BigInteger.valueOf(b).pow(a).negate()));
}
}
}


原文地址:https://www.cnblogs.com/staginner/p/2319904.html