首页 > 其他 > 详细

球自由降落问题

时间:2015-09-05 20:34:23      阅读:213      评论:0      收藏:0      [点我收藏+]
package javabasi;
/**
 * 题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在   第10次落地时,共经过多少米?第10次反弹多高?
 * @author dlmu
 *
 */
public class BallBounce {
    public static void main(String[] args) {
        double height = 100;
        double length = 0;
        for (int i = 1; i <= 10; i++) {
            length = length + height;
            height = height / 2;

        }
        System.out.println("after 10 times, the final height is:" + height);
        System.out.println("total length it has passed is:" + length);
    }
}

逻辑要明确,计算清楚,看清题

球自由降落问题

原文:http://www.cnblogs.com/fthjane/p/4783746.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!