```c #include <stdio.h> int main() { double h; // 初始高度 scanf("%lf", &h); // 读取初始高度 double total_distance = h; // 总距离,初始为第一次下落的高度 double current_height = h; // 当前高度 for (int i = 1; i < 10; i++) { current_height /= 2; // 每次反弹高度减半 total_distance += 2 * current_height; // 每次反弹和下落的总距离 } printf("%g\n", total_distance); // 输出总距离 printf("%g\n", current_height / 2); // 输出第10次反弹的高度 return 0; } ``` 需要注意的逻辑点: 1. 总距离的计算需要考虑每次反弹和下落的两段距离。 2. 第10次反弹的高度是第10次落地后反弹的高度,因此需要在循环结束后再除以2。 3. 使用`%g`格式化输出可以自动选择合适的精度,避免不必要的零。 [2025-02-20 19:38:01 | AI写代码神器 | 234点数解答]