help WA 80

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

djc2012 @ 2024-12-16 13:21:05


#include<bits/stdc++.h>
using namespace std;
int main(){
    int s,v,t,t1,time,h,m;
    scanf("%d %d",&s,&v);
    if(s%v==0) t1=s/v;
    else if(s%v!=0) t1=s/v+1;
    t=t1+10;
    if(t>480) time=1440-(t-480);
    else time=480-t;
    h=time/60;
    m=time-60*h;
    if(m!=0){
        if(h>=10) printf("%d:%d",h,m);
        else printf("0%d:%d",h,m);
    }else{
        if(h>=10) printf("%d:%02d",h,m);
        else printf("0%d:%02d",h,m);
    }
    return 0;
}

by YuYi_official @ 2024-12-16 19:32:16

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double s,v;
    cin>>s>>v;
    int m=8*60+24*60;
    int t=ceil(s/v)+10;
    m=m-t;
    if(m>60*24)
    m=m-60*24;
    int g=m%60;
    int h=ceil(m/60);
    if(h<10)
    {
        if(g<10) cout<<"0"<<h<<":0"<<g;
        else cout<<"0"<<h<<":"<<g;
    }
    else
    {
        if(g<10) cout<<h<<":0"<<g;
        else cout<<h<<":"<<g;
    }
}

by Sunweijie @ 2024-12-23 21:05:29

#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
    int s,v;
    scanf("%d%d",&s,&v);
    int t=ceil(1.0*s/v)+10;
    int from=60*(24+8)-t;
    int h=(from/60)%24;
    int m=from%60;
    printf("%02d:%02d",h,m);
    return 0;
}

|