30pts求改

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

maowmaow @ 2024-11-12 20:51:53

#include <bits/stdc++.h>
using namespace std;
int s,v,t;
int main(){
    cin>>s>>v;
    if(s%v==0){
        t=s/v+1+10;
    }else{
        t=ceil(s/v)+1+10;
    }
    if(t>60){
        int a,b;
        a=t%60;
        b=t/60;
        if(b<8){
            if(a<10&&b<10){
                cout<<"0"<<b<<":"<<"0"<<a<<endl;
            }else if(a>10&&b<10){
                cout<<"0"<<b<<":"<<a<<endl;
            }else if(a<10&&b>=10){
                cout<<b<<":0"<<a;
            }else{
                cout<<b<<":"<<a;
            }
        }else{
            b=24-b+8;
            if(a<10&&b<10){
                cout<<"0"<<b<<":"<<"0"<<a<<endl;
            }else if(a>10&&b<10){
                cout<<"0"<<b<<":"<<a<<endl;
            }else if(a<10&&b>=10){
                cout<<b<<":0"<<a;
            }else{
                cout<<b<<":"<<a;
            }
        }
    }else{
        if(t>50){
            cout<<"07:"<<"0"<<60-t<<endl;
        }else{
            cout<<"07:"<<60-t<<endl;
        }
    }
    return 0;
}

|