90#9求解

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

z1443888087 @ 2024-08-10 16:38:50

代码如下```cpp

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

|