• 求球第10次落地时,共经过多少米?第10次反弹多高?


    题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在10次落地时,共经过多少米?第10次反弹多高?

     1 package com.li.FiftyAlgorthm;
     2 
     3 /**
     4  * 题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,
     5  * 求它在 第10次落地时,共经过多少米?第10次反弹多高?
     6  * @author yejin
     7  */
     8 public class TreeFall {
     9     static double height = 100;
    10     static double distance = 100;
    11     public static void main(String[] args) {
    12        for(int i=1; i<10; i++) {
    13         distance = distance + height;
    14         height = height / 2;
    15        }
    16      
    17        System.out.println("路程:" + distance);
    18        System.out.println("高度:" + height / 2);
    19     }
    20 }
  • 相关阅读:
    net core 3.1 依赖注入
    vue temeplete standard
    net core 3.1 Global
    vue Multiple selection
    c# mvc modelstate
    vue temeplete
    vue element pickdate combox input 排版
    c# 生成 验证码
    vue checkbox ajax
    js算法(2)
  • 原文地址:https://www.cnblogs.com/justdoitba/p/7142771.html
Copyright © 2020-2023  润新知