import java.util.*;
import java.io.*;
public class Main {
private int num;
private double sum;
private double stl;
public static void main(String args[]){
Main op = new Main();
Scanner cin = new Scanner(System.in);
while(true){
boolean boo= op.oCin(cin);
if(!boo){
return;
}
op.giveNum();
op.printNum();
}
}
public boolean oCin(Scanner cin){
stl = cin.nextDouble();
if(stl == 0)
return false;
else
return true;
}
public void giveNum(){
double i;
sum = 0;
for(i = 1;;++ i){
sum += 1/(i+1);
if(sum >= stl){
num = (int)i;
return;
}
}
}
public void printNum(){
System.out.println(num+" "+"card(s)");
}
}
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com