helloroot


私信TA

用户名:helloroot

访问量:10136

签 名:

等  级
排  名 5315
经  验 1490
参赛次数 0
文章发表 14
年  龄 0
在职情况 学生
学  校 上海交通大学
专  业

  自我简介:

解题思路:





注意事项:
我也不想多说什么,可能是我理解有问题,最后一次弹起的距离竟然不算.




参考代码:

#include <stdio.h>

int main()
{
	int times,i;
	float height,sum=0,result;
	scanf("%f%d", &height,&times);
	for(i=1;i<=times;i++){
		sum+=height;
		result = height/2.0;
		if (i!=times){
			sum+=result;
		}
		height=result;
	}
	printf("%.2f %.2f\n",result,sum);
	return 0;
}


 

0.0分

0 人评分

  评论区