poj1003 java
来源:互联网 发布:第一款聊天软件 编辑:程序博客网 时间:2024/05/17 09:29
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
while(cin.hasNext()){
double f = cin.nextFloat();
if(f == 0)
return;
if(f <=0.5){
System.out.println("1 card(s)");
continue;
}
int ans = 1;
double sum = 0.5;
int base = 2;
do{
base++;
ans++;
sum += 1.0/base;
}while(sum < f);
System.out.println(ans + " card(s)");
}
}
}
public class Main {
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
while(cin.hasNext()){
double f = cin.nextFloat();
if(f == 0)
return;
if(f <=0.5){
System.out.println("1 card(s)");
continue;
}
int ans = 1;
double sum = 0.5;
int base = 2;
do{
base++;
ans++;
sum += 1.0/base;
}while(sum < f);
System.out.println(ans + " card(s)");
}
}
}
0 0
- poj1003 java
- POJ1003
- POJ1003
- poj1003
- poj1003
- poj1003
- POJ1003
- POJ1003
- poj1003
- POJ1003
- poj1003
- POJ1003
- Poj1003
- poj1003
- poj1003
- poj1003
- POJ1003
- poj1003
- css命名规则说明
- Bitmap recycle方法与制作Bitmap的内存缓存
- 简洁设计,20个很有特色的网站头部设计
- linux 命令学习小结
- svn 解决文件本地冲突
- poj1003 java
- jQuery里ready、load方法的区别
- 【提醒】使用 iptables 时,特别注意 规则的顺序
- 动态注册JNI
- Neutron Group Based Policy 印象 (by quqi99)
- Web前端构建工具版本号管理方案思考
- Android模拟器中模拟缩放
- MFC打开连接QQ对话框的方法
- Git 分支