60分求解,只过了前六个

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

hulafu @ 2024-02-28 12:30:18

#include <bits/stdc++.h>
using namespace std;

int main() {
    double s, v;
    cin >> s >> v;
    int time = ceil(s / v) + 10;
    int hour = (8 * 60 - time) / 60;
    int minute = (8 * 60 - time) % 60;
    if (hour < 0) {
        hour += 24;
        minute += 60;
    } else if (hour == 0) {
        minute += 60;
    }
    cout << setfill('0') << setw(2) << hour << ":" << setw(2) << minute;
    return 0;
}

|