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写成的,我自己电脑上好好的,为什么就是一直wa

Posted by guoz0003 at 2007-10-24 21:39:18 on Problem 1003
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		double input, output;
		int n;
		while((input=sc.nextDouble())!=0){
			n=1;
			output=0.5;
			while(input>output){
				n++;
				output+=1.0/(n+1);
			}
			System.out.println(n+" cards(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