题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
https://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
import java.util.*; public class Main { public static void main(String[] args) { Scanner fzhinput = new Scanner(System.in); float csgd = fzhinput.nextFloat(); float gd=csgd,dwcgd; float dqgd=csgd; for(int i=1;i<5;i++){ gd=gd+dqgd; dqgd/=2; } dwcgd = dqgd/2; System.out.println(gd); System.out.println(dwcgd); } }