题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
https://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
import java.util.Scanner; //直接计算结果 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int height = in.nextInt(); float all = height + 2*((float) height / 2 +(float) height / 4 + (float) height / 8 + (float) height / 16); float five = (float) height / 32; System.out.println(all); System.out.println(five); } }