【HDOJ】1063 Exponentiation
这道题目莫名其妙的wa,又莫名其妙的过了。
1 import java.util.Scanner; 2 import java.math.BigDecimal; 3 4 public class Main { 5 public static void main(String[] args) { 6 Scanner cin = new Scanner(System.in); 7 while (cin.hasNext()) { 8 BigDecimal br = cin.nextBigDecimal(); 9 int n = cin.nextInt(); 10 String ans = br.pow(n).stripTrailingZeros().toPlainString(); 11 int i; 12 for (i=0; i<ans.length(); ++i) 13 if (ans.charAt(i) != '0') 14 break; 15 String val = ans.substring(i, ans.length()); 16 17 System.out.println(val); 18 } 19 } 20 }