题解 | 求小球落地5次后所经历的路程和第5次反弹的高度
#include <iostream> using namespace std; int main() { double h; cin >> h; // i 表示第几次反弹 double sum = h; for (int i = 1; i <= 5; i ++) { h /= 2; sum = sum + 2 * h; } cout << sum - 2*h << endl; cout << h << endl; // while (cin >> a >> b) { // 注意 while 处理多个 case // cout << a + b << endl; // } } // 64 位输出请用 printf("%lld")