90分求助

P5707 【深基2.例12】上学迟到

yanshuai666 @ 2024-11-09 15:43:55

#include <bits/stdc++.h>
using namespace std;
const int N = 101001;

int main()
{
    double s, v;
    cin >> s >> v;
    int t = 10;
    t += ceil(s / v); // 向上取整
    int num = ceil((double)t / 60);
    int HH = 8, MM = (60 - t % 60) % 60;
    HH = 8 - num;
    if (HH <= 0)
        HH = 24 - (num - 8);
    if (HH < 10 && HH > 0)
        cout << "0";
    cout << HH << ":";
    if (MM < 10)
        cout << "0";
    cout << MM;

    return 0;
}

by c22j33c43 @ 2024-11-09 16:00:57

删了

&&H>0

by c22j33c43 @ 2024-11-09 16:02:26

HH<=0改成HH<0

by c22j33c43 @ 2024-11-09 16:04:05

例:470 1

Yours answer24:00

true answer 0:00


|