解题思路:
注意事项:
我也不想多说什么,可能是我理解有问题,最后一次弹起的距离竟然不算.
参考代码:
#include <stdio.h> int main() { int times,i; float height,sum=0,result; scanf("%f%d", &height,×); 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 人评分
C语言训练-求PI* (C语言代码)浏览:613 |
【简单计算】 (C语言代码)浏览:622 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:5228 |
【计算球体积】 (C语言代码)浏览:1101 |
母牛的故事 (C语言代码)浏览:1427 |
母牛的故事 (C语言代码)浏览:715 |
A+B for Input-Output Practice (V) (C语言代码)浏览:459 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1149 |
1050题解(结构体数组与结构体指针的使用)浏览:1106 |
复数求和 (C语言代码)浏览:916 |