提交时间:2026-01-04 15:09:49
运行 ID: 80247
#include <iostream> #include <cmath> // 用于 pow 函数,但本题可以不用 using namespace std; int main() { double h; cin >> h; double totalDistance = h; // 初始下落高度 double currentHeight = h; // 当前弹跳高度,初始为h // 循环计算第1次到第9次落地之间的路程 for (int i = 1; i <= 9; i++) { currentHeight /= 2.0; // 第i次反弹的高度 totalDistance += 2.0 * currentHeight; // 反弹+下落 } // 第10次反弹的高度 double tenthBounceHeight = currentHeight / 2.0; // 第10次反弹是第9次反弹高度的一半 // 输出 cout << totalDistance << endl; cout << tenthBounceHeight << endl; return 0; }