Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
觉得用JAVA比C++简单多了import java.util.*; import java.math.*; class Main{ public static void main(String []args){ BigDecimal a; int b; Scanner cin=new Scanner(System.in); while(cin.hasNext()){ a=cin.nextBigDecimal(); b=cin.nextInt(); String s=a.pow(b).toPlainString(); //去掉后面的零 int q=s.length()-1; while(s.charAt(q)=='0')q--; if(s.charAt(q)=='.')q--; //去掉前面的0 int p=0; while(s.charAt(p)=='0')p++; for(int i=p;i<=q;i++){ System.out.print(s.charAt(i));} System.out.println(); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator