wa求助

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

wanghanyi8191 @ 2023-12-09 15:06:18

#include<bits/stdc++.h>
using namespace std;
int main(){
    double s,u,t,f,m;
    s = 0;
    u = 0;
    t = 0;
    f = 0;
    m = 0;
    cin>>s>>u;
    t = ceil(s/u);
    t = t+10;
    if (t > 480){
        t = t-480;
        f = 23;
        m = 60;
        while(t > 60){
            t = t-60;
            f--;
        }
        if(t = 0){
            f++;
            m = 0;
        }else{
            m = m-t;
        }
    }else{
        f = 7;
        m = 60;
        while(t > 60){
            t = t-60;
            f--;
        }
        if(t = 0){
            f++;
            m = 0;
        }else{
            m = m-t;
        }
    }
    if (f < 10){
        cout <<"0"<<f<<":";
    }else{
        cout<<f<<":";
    }
    if (m < 10){
        cout <<"0"<<m;
    }else{
        cout<<m;
    }
    return 0;
}

求助0分


|