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);
}