Height Half Values
public class HeightDemo {
/**
* 题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;
* 再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
*/
public static void main(String[] args) {
double h = 100;
double total = 0;
for (int i = 0; i < 10; i++) {
if (i == 0) {
total = total + h;
} else {
h = h / 2;
total = total + 2 * h;
}
}
System.out.println("total=" + total);
System.out.println("h=" + h);
}
}
Height Half Values的更多相关文章
- IE兼容性问题汇总【持续更新中】
问题:IE8/9不支持Array.indexOf 解决方案 if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt ...
- CSS魔法堂:深入理解line-height和vertical-align
前言 一直听说line-height是指两行文本的基线间的距离,然后又说行高等于行距,最近还听说有个叫行间距的家伙,@张鑫旭还说line-height和vertical-align基情四射,贵圈真乱啊 ...
- 简单研究Android View绘制二 LayoutParams
2015-07-28 17:23:20 本篇是关于LayoutParams相关 ViewGroup.LayoutParams文档解释如下: LayoutParams are used by views ...
- HIbernate学习笔记(七) hibernate中的集合映射和继承映射
九. 集合映射 1. Set 2. List a) @OrderBy 注意:List与Set注解是一样的,就是把Set更改为List就可以了 private List< ...
- html5 laboratory - drawing in the canvas
html5 laboratory - drawing in the canvas Creating a bar chart with canvas 21st February 2010 The exp ...
- iOS_第3方类库_BlurAlertView_GPUImage
最终效果图: 先加入GPUImage.framework 导入BlurAlertView的类声明和类实现 // // BlurAlertView.h // 特效弹出框 // // Created by ...
- Hibernate 学习教程
第1课 课程内容. 6 第2课Hibernate UML图. 6 第3课 风格. 7 第4课 资源. 7 第5课 环境准备. 7 第6课 第一个演示样例HibernateHelloWorld 7 第7 ...
- mplayer最全的命令
前段时间做过qt内嵌mplayer的一个小程序,感觉mplayer还行不过不支持打开图片感觉有点无力.话不多说上代码: QString path="d:/1.mkv"; QWidg ...
- Hibernate 马士兵 学习笔记 (转)
目录(?)[+] 第2课 Hibernate UML图 第3课 风格 第4课 资源 第5课 环境准备 第6课 第一个示例Hibernate HelloWorld 第7课 建立Annotation版本的 ...
随机推荐
- Hadoop 调研笔记
由于从各光伏电站采集的数据量较大,必须解决海量数据的查询.分析的问题.目前主要考虑两种方式:1. Hadoop大数据技术:2. Oracle(数据仓库)+BI: 本文仅介绍hadoop的技术 ...
- poj3678 Katu Puzzle 2-SAT
Katu Puzzle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6714 Accepted: 2472 Descr ...
- Java内部类,枚举
模式: 模板模式: 简单工厂模式: 适配器模式: interface ICellPhone { void sendMsg(); } class Android implements ICel ...
- machine leanring 笔记 vectorization
the summation of the product of two terms can be expressed as the product of two vectors ps. surf ...
- Android_SQLite之创建数据库
今天我们主要学习了SQLite.主要是其中的创建数据库,连接这块. 现在我们先简单讲解下什么是SQLite 一.SQLite 简介 Google为Andriod的较大的数据处理提供了SQLite, 他 ...
- CSS z-index 属性
定义和用法 z-index 属性设置元素的堆叠顺序.拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面. 注释:元素可拥有负的 z-index 属性值. 注释:Z-index 仅能在定位元素上奏 ...
- 9×9扫雷游戏代码-C写的
#include <stdio.h> #include <stdlib.h> //画棋盘 a雷表 b周围雷数表 c打开表 ][],][],][]) { ,j=; ;i<; ...
- thinkphp model模块
1.获取系统常量信息的方法:在控制器DengLuController里面下写入下面的方法,然后调用该方法. public function test() { //echo "这是测试的&qu ...
- 反汇编工具capstone安装后import error
使用sudo pip install capstone后,使用如下代码import时出现error. from capstone import * 错误信息: File "/usr/loca ...
- MAC 安装j2ee.sh的办法
It says it needs the DISPLAY variable set - what do I need to set it to? Instead of saying: ./java_e ...