解题思路:模拟
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = ""; while ((s = br.readLine()) != null) { double height = Double.parseDouble(s); // length at 1st get ground double length = height + 0.0; for (int i = 2; i <= 5; i++) { length += height; height /= 2; } System.out.println(length); System.out.println(height/2); } br.close(); } }