uva 748 Exponentiation

import java.util.Scanner;

import java.math.BigDecimal;



public class Main{

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);

		BigDecimal a;

		int n;

		while(in.hasNext()){

			a = in.nextBigDecimal();

			n = in.nextInt();

			String s = a.pow(n).stripTrailingZeros().toPlainString();

			if(s.startsWith("0"))

				s = s.substring(1);

			System.out.println(s);

		}

	}

}

 

你可能感兴趣的:(exp)