标签:
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1063
1 import java.math.BigInteger; 2 import java.math.BigDecimal; 3 import java.util.Scanner; 4 5 public class Main { 6 7 public static void main(String[] args) { 8 Scanner cin = new Scanner(System.in); 9 int n; 10 BigDecimal a,r; 11 while(cin.hasNextFloat()){ 12 a = cin.nextBigDecimal(); 13 n = cin.nextInt(); 14 r = BigDecimal.ONE; 15 for(int i = 1;i<=n;i++) 16 r = r.multiply(a); 17 String s = r.stripTrailingZeros().toPlainString(); 18 if(s.charAt(0)==‘0‘) 19 System.out.println(s.substring(1)); 20 else 21 System.out.println(s); 22 23 } 24 } 25 }
标签:
原文地址:http://www.cnblogs.com/blueprintf/p/4703527.html