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 |
这个程序有什么问题,一直wa,我晕死了-_-import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String line = stdin.readLine(); BigDecimal r; while(line!=null){ StringTokenizer st = new StringTokenizer(line); //if(!st.hasMoreTokens())continue; r=new BigDecimal(st.nextToken()); int p=Integer.parseInt(st.nextToken()); String s= new BigDecimal(r.movePointRight(10).toBigInteger().pow(p)).movePointLeft(10*p).toString(); int i,j; for(i=0;i<s.length();++i) if(s.charAt(i)!='0')break; for(j=s.length()-1;j>=0;--j) if(s.charAt(j)!='0')break; if(s.charAt(j)=='.')--j; System.out.println(s.substring(i,j+1)); line=stdin.readLine(); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator