Poj1001

import java.math.BigDecimal;
import java.util.Scanner;


public class Main {

	//大数据计算
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
		BigDecimal R=scan.nextBigDecimal();
		int n = scan.nextInt();
	
		if(n<=0||n>25){
			return;
		}
		
		R=R.pow(n).stripTrailingZeros();
		//输出,如果是整数,不要输出小数点
		if(R.toPlainString().substring(0, 1).equals("0")){
			String str = R.toPlainString().substring(1);
			System.out.println(str);
		}else{
			System.out.println(R.toPlainString());
		}
		}
	}
}

你可能感兴趣的:(Poj1001)