Huawei oj--the distance and the height of the 5th rebound after the ball landed 5 times

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.