题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
http://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
#include <algorithm>
using namespace std;
int main() {
double H;
while(cin>>H){
double L=H,bounce=H;
for(int i = 0;i<5;i++){
bounce/=2;
L+=bounce*2;
}
cout<<(L-2*bounce)<<endl<<bounce;
}
}