en14399:题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在

来源:百度文库 编辑:高校问答 时间:2024/05/01 02:33:12

public class freefall {
public static void main(String[] args) {
int n = 10;
double high = 100;
for (int i = 0; i < 10; i++) {
high /= 2;
}
System.out.println("下落" + n + "次的高度为" + high);
}
}

100/2/2/2/2/2/2/2/2/2//2/2/2//2/2/2/2/n个2=0

t100(1+1/2+1/4+1/8+1/n)=time

main()
{
float sn=100.0,hn=sn/2;
int n;
for(n=2;n<=10;n++)
{
sn=sn+2*hn;/*第n次落地时共经过的米数*/
hn=hn/2; /*第n次反跳高度*/
}
printf("the total of road is %f\n",sn);
printf("the tenth is %f meter\n",hn);
}

题目都不全的
如果真这样,永远不会停