C++ 计算球的弹跳高度和总距离
#include
int main() { double M, N; cin >> M >> N;
double height = M;
double distance = M;
for (int i = 1; i < N; i++) {
height /= 2;
distance += height * 2;
}
height /= 2;
cout << fixed << setprecision(2) << height << ' ' << distance << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/bBAG 著作权归作者所有。请勿转载和采集!