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

我的代码哪里有问题啊?老是RuntimeError

Posted by Gerodan at 2012-09-28 15:30:49 on Problem 1003
package cn.g;

import java.util.Scanner;

public class Main{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		while(true){
		Scanner cin=new Scanner(System.in);
        double end=cin.nextDouble(),sum=0;
        int cardNums=1;
        	if(end==0.00||end<0.01 ||end>5.20) break;
        	for(;sum<end;cardNums++){
        		 sum+=1.0/(cardNums+1);
        	}
        	System.out.println((cardNums-1)+" card(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