第三 第五有问题

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

ccccjjjj123 @ 2024-10-10 20:57:41


#include<iostream>;
using namespace std;
int main() {
    double s, v;
    cin >> s >> v;
    double t1 = s / v;
    int t2 = s / v;
    int t = 0;
    if (t1 == t2) {
        t = t1;
}
    else {
        t = t2 + 1;
    }
    t = t + 10;
    if ((t / 60) <8) {
        if (t % 60 == 0) {
            cout << "0" << 8 - t / 60 << ":" << "00" << endl;
        }
        else if(t/60==0){
            cout << "0" << 8 - (t / 60)-1 << ":" << 60 - (t - (t / 60) * 60) << endl;
        }
        else {
            cout << "0" << 8 - (t / 60) - 1 << ":" << 60 - (t - (t / 60) * 60) << endl;
        }
    }
    else if (double(t) / 60.0 == 8) {
        cout << "00" << ":" << "00" << endl;
    }
    else {
        if (t % 60 == 0) {
            cout << 24 - (t/60 - 8) << ":" << "00" << endl;
        }
        else {
            cout << 24 - (t / 60 - 8) - 1 << ":" << 60 - (t - t / 60 * 60) << endl;
        }
    }
}

|