Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
80247 sh25_huangse 球弹跳高度的计算 C++ 通过 0 MS 248 KB 747 2026-01-04 15:09:49

Tests(1/1):


#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; }


测评信息: