70pts,help

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

TiAmo_TerSempre @ 2024-08-10 20:19:13

#include<bits/stdc++.h>
using namespace std;

double s,v,hour=8,minn=0;

int main()
{
    cin>>s>>v;
    if(ceil(s/v)>10) minn-=10;
    minn-=ceil(s/v);
    if(hour*60 + minn>=24*60) minn-=24*60;
    while(minn<0){
        minn+=60;
        hour--; 
    }
    if(hour<10){
        cout<<0;
    }
    cout<<hour<<":";
    if(minn<10){
        cout<<0;
    }
    cout<<minn;
    return 0;
}

by godogod @ 2024-08-23 14:44:40

是不是有一些判定没有


by godogod @ 2024-08-23 14:47:01


#include<bits/stdc++.h>
using namespace std;
long long n,h,m,x,y;
double s,v; 
int main()
{
    cin>>s>>v;
    h=24*60+8*60;
    n=ceil(10+s/v);
    m=h-n;
    x=m/60;
    y=m%60;
    if(x>=24) x=x-24;
    if(x<10) cout<<"0";
    cout<<x<<':';
    if(y<10) cout<<"0";
    cout<<y;
    return 0;
}
我的code

by godogod @ 2024-08-23 14:47:16

@TiAmo_TerSempre


|