解题思路:
注意事项:
我也不想多说什么,可能是我理解有问题,最后一次弹起的距离竟然不算.
参考代码:
#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语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:567 |
成绩转换 (C语言代码)浏览:1004 |
打水问题 (C语言代码)浏览:1063 |
WU-复数求和 (C++代码)浏览:1995 |
WU-格式化数据输出 (C语言代码)浏览:1740 |
WU-陶陶摘苹果2 (C++代码)浏览:967 |
简单的a+b (C语言代码)浏览:573 |
打印十字图 (C语言代码)浏览:2700 |
简单的a+b (C语言代码)浏览:524 |
矩形面积交 (C语言代码)浏览:1293 |