#include <stdio.h>
#include <math.h>

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    double distance = n; // 初始高度为n
    double height = n; // 初始高度为n

    for (int i = 1; i <= m; i++) {
        distance += height * 2; // 每次落地后,路程增加两倍的反弹高度
        height /= 4; // 反弹高度为原高度的四分之一
    }

    printf("%.2f\n", distance);
    printf("%.2f", height);

    return 0;
}
C语言程序:计算小球反弹路程和高度

原文地址: https://www.cveoy.top/t/topic/pfvX 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录