Poj1003

import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		
		double length ;
		length = scan.nextDouble();
		while(length!=0.00){
			if(length<0.01 || length>5.20){
				return;
			}		
			int card=1;
			double sum = 0;
			while(sum<length){
				sum = sum+(double)1/(card+1);
				card++;
			}
			System.out.println((card-1)+" card(s)");
			
			length = scan.nextDouble();
		}
	}
}


你可能感兴趣的:(Poj1003)