大数a的n次幂,直到读到EOF(文件结尾)为止,其中忽略小数后面的0
1 import java.util.*; 2 import java.math.*; 3 import java.text.*; 4 public class Main 5 { 6 public static void main(String[] args) 7 { 8 Scanner cin=new Scanner(System.in); 9 BigDecimal a; 10 int n; 11 String s; 12 while(cin.hasNext()) 13 { 14 a=cin.nextBigDecimal(); 15 n=cin.nextInt(); 16 a=a.pow(n).stripTrailingZeros(); 17 s=a.toPlainString(); 18 if(s.charAt(0)=='0') 19 s=s.substring(1); 20 System.out.println(s); 21 } 22 } 23 }