解题思路:





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




参考代码:

#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 人评分

  评论区