Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

用java所有测试数据都过了,怎么还有runtime error啊~~求助!!!

Posted by ch2009120504 at 2011-05-09 21:26:25 on Problem 1001 and last updated at 2011-05-09 21:27:32
这是代码:不甚感激!
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String arg[]){
	   String s;
       BigDecimal a,c;
       int i,n;
       c=BigDecimal.valueOf(0);
       Scanner in=new Scanner(System.in);
       while(true){
    	   a=in.nextBigDecimal();
    	   n=in.nextInt();
    	   c=a.pow(n);
    	   s=c.toPlainString();
    	   for(i=s.length()-1;i>=0;i--)
    		   if(s.charAt(i)!='0')break;
    	   s=s.substring(0,i+1);
    	   if(s.charAt(0)=='0')s=s.substring(1,s.length());
    	   System.out.println(s);
    	   }
       }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator