Title Description
Suppose a ball falls freely from any height, and jumps back to half its original height after each landing; How many meters will it take for the 5th time to fall? How high is the 5th rebound?
/**
* Statistics on the 5th time when the landing, the total number of meters?
*
* @param start height of high ball
* @return The number of English letters
*/
public static double Getjourney (int high)
{
return 0;
}
/**
* Statistics on the 5th rebound how high?
*
* @param start height of high ball
* @return the number of spaces
*/
public static double Gettenthhigh (int high)
{
return 0;
}
Input Description:
Input start height, int type
Output Description:
Output of the 5th time when the landing, the total number of meters of the 5th time rebound how high
Input Example:
1
Output Example:
2.8750.03125
<span style= "FONT-SIZE:18PX;" >import java.util.*;p ublic class main{public static void Main (string[] args) {Scanner scan=new Scanner (system.in); while (Scan.hasnext ()) {int high=scan.nextint ();d ouble distance=0;double height=0;distance=high* (2+0.5+0.25+0.125); height=high*0.03125; System.out.println (distance); SYSTEM.OUT.PRINTLN (height);}}} </span>
Huawei oj--the distance and the height of the 5th rebound after the ball landed 5 times