题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
http://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
#include <stdio.h>
int main(int argc, char** argv)
{
float input;
scanf("%f", &input);
float distance = input; input /= 2;
for (int i = 1; i < 5; i++) { distance += input * 2; input /= 2; }
printf("%g\n%g\n", distance, input);
return 0;
}