最后一个AC不了,90分求教

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

qwertyuuiigfvcgv @ 2023-11-02 09:11:57

#include<iostream>
using namespace std;
int s,v;
int main(){
    cin>>s>>v;
    int m;
    int dh;
    if(s%v==0){
        m = s/v + 10; 
    }else{
        m = s/v + 10 + 1; 
    }
    if(m%60==0){
        dh = m/60;
    }else{
        dh = m/60 + 1;
    }
    int h = 8;
    if(h-dh>=0){
        h -= dh;
    }else{
        h = 24 - dh + 8;
    }
    int n = (-1) * (m - dh * 60);
    if(h>10){
        if(n>10){
            cout<<h<<":"<<n;
        }else{
            cout<<h<<":0"<<n;
        }
    }else{
        if(n>10){
            cout<<"0"<<h<<":"<<n;
        }else{
            cout<<"0"<<h<<":0"<<n;
        }
    }
}

|