wa第四个检测点。o(╥﹏╥)o求教
查看原帖
wa第四个检测点。o(╥﹏╥)o求教
619811
HonmaMeiko_楼主2023/11/23 06:34

wa了第四个检测点。read 5 expected 4.o(╥﹏╥)o

思路做题: 要得到“ 完整的苹果 数量 ”

完整的苹果数量,I.如果吃完的时候,计时器没结束。则 剩余 “ 完整的苹果数量 ”0。

II.如果计时器结束,没吃完。

① 则“完整的苹果数量”为 m(总数)- v(速度) * s(时间);

② 因为存在小数部分, “ 完整的苹果数量 ”实际是.0 printf出来的。

/*
完整的苹果numbers== 剩余的苹果数量;②向下取整数(.0)
*/
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

double numbers;

int main() {
    double m = 0, t = 0, s = 0;
    cin >> m >> t >> s;

    double realTime = m * t;

    if (realTime < s) {
        printf("0");
    } else {
        double v = 1 / t;
        numbers = m - v * s;
        printf("%.0lf", numbers);
    }

    return 0;
}

2023/11/23 06:34
加载中...