import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("请输入球的初始高度(m): ");
double height = sc.nextDouble();
// 初始化变量
double currentHeight = height;
double bounceHeight = height;
int count = 0;
while (currentHeight > 0) {
// 记录弹跳次数
count++;
// 计算弹跳高度
if (count == 1) {
bounceHeight = height;
} else {
bounceHeight *= 0.95;
}
// 计算弹起后的高度
currentHeight = currentHeight - bounceHeight * 2;
// 如果球落地,则程序停止运行
if (currentHeight <= 0) {
break;
}
}
System.out.println("球需要弹跳" + count + "次才能停止下落。");
}
}