Free fall of small ball (OJ platform)

Source: Internet
Author: User

A ball falls freely from the height of M. After each landing, it returns half of the original height and then drops.

How high does it rebound when the nth landing? How many meters are there? Retain two decimal places

# Include <iostream> # include <iomanip> using namespace STD; void distance (double, INT); int main () {double m; int N; cin> m> N; distance (m, n); Return 0;} void distance (double M, int N) {int I = 0; double S = 0; for (I = 0; I <n; I ++) {S = S + 3 * m/2; M = m/2;} cout <setiosflags (IOs :: fixed); cout. precision (2); // retain two decimal places .. Cout <m <"" <s-m ;}

Related Article

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.