求助 只有50分

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

jiangzhongrui @ 2024-10-27 17:27:51

#include<bits/stdc++.h>

using namespace std;

int main() {
    int s,v,time=7*60+50,HH,MM;
    int t;
    cin>>s>>v; 
    t=s/v;
    if(s%v!=0)
    {
        t=t+1;
    }
    if(t<time)
    {
        time=time-t;
    }
    else
    {
        time=24*60-(t-time);
    }
    HH=time/60;
    MM=time%60;
    if(HH>7)
    {
        HH=24-(HH-7);
        if(HH<10)
        {
            cout<<"0"<<HH<<":"<<MM;
        }
        else
        {
            cout<<HH<<":"<<MM;
        }
    }
    else
    {
        cout<<"0"<<HH<<":"<<MM;
    }

return 0;
}

|