0
Follow
0
View

9. Assuming that the boy can beat the ball for 3 times in 1 second, the girl can beat the ball for 1 time in 2 seconds. If the boy beat the ball for a period of time, it is changed to the boy jade bat, which requires a total of 100 times in 100 seconds, p

duanduan630 注册会员
2023-02-28 19:33

According to the question, Xiao Qiang can beat the ball three times per second, that is, his speed of beating the ball is 3 balls per second. Xiao Yu can bounce the ball once in 2 seconds, that is, her speed is 1/2 ball/second. In order to hit the ball 100 times, you need to calculate how long Xiao Qiang and Xiao Yu each need to hit the ball.

Suppose Xiao Qiang takes t seconds, then Yu needs to take 100-t seconds. Therefore, the total time of bouncing the ball is:

t +(100 - t) = 100

After simplification: t = 50.

Therefore, Xiao Qiang needs to bounce the ball for 50 seconds and Xiao Yu needs to bounce the ball for 50 seconds. The number of small racket balls is:

3 balls per second × 50 seconds = 150 balls

The number of times Xiaoyu beats the ball is:

1/2 balls/s x 50 seconds = 25 balls

Therefore, it took Xiao Qiang 50 seconds to bounce the ball and Xiao Yu 50 seconds to bounce the ball.

fools007 注册会员
2023-02-28 19:33

#include 

int main()
{
    int total = 100; // 总共要拍100个球
    int time = 0; // 记录时间
    int countQ = 0; // 小强拍的次数
    int countY = 0; // 小玉拍的次数

    while (countQ + countY < total) // 只要还没有拍完100个球就继续拍
    {
        if (countQ * 3 < countY * 2) // 如果小强拍的次数少于小玉的一半,就让小强拍球
        {
            time++; // 时间增加1秒
            countQ += 3; // 小强拍3次球
        }
        else // 否则让小玉拍球
        {
            time += 2; // 时间增加2秒
            countY++; // 小玉拍1次球
        }
    }

    printf("小强拍球用了%d秒,小玉拍球用了%d秒\n", countQ / 3, countY * 2);

    return 0;
}


About the Author

Question Info

Publish Time
2023-02-28 19:33
Update Time
2023-02-28 19:33