| ||||||||||
| 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 | |||||||||
Re:高手请看以下:java写成的,我自己电脑上好好的,为什么就是一直waIn Reply To:高手请看以下:java写成的,我自己电脑上好好的,为什么就是一直wa Posted by:guoz0003 at 2007-10-24 21:39:18 > 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator