3,5错(帮帮蒟蒻)

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

DDV1 @ 2024-08-08 15:35:53

#include<bits/stdc++.h>
using namespace std;
int main(){
    int s,v,add=480;
    cin>>s>>v;
    int y;
    if(s%v==0)
    y=s/v;
    else 
    y=s/v+1;
    y=y+10;
    int H=y/60,M=y%60; 
    if(y<=480){
        if(M==0)
        cout<<"0"<<8-H<<":00";
        else
        cout<<"0"<<7-H<<":"<<60-M;
    } 
    if(y>480){
        if(M==0 and 24-(H-8)>=10)
        cout<<24-(H-8)<<":00";
        if(M==0 and 24-(H-8)<10)
        cout<<"0"<<24-(H-8)<<":00";
        if(M!=0 and 24-(H-8+1)>=10 and 60-M>=10)
        cout<<24-(H-8+1)<<":"<<60-M;
        if(M!=0 and (24-(H-8+1)<10) and 60-M>=10)
        cout<<"0"<<24-(H-8+1)<<":"<<60-M<<endl;

        if(M!=0 and 24-(H-8+1)>=10 and 60-M<10)
        cout<<24-(H-8+1)<<":"<<"0"<<60-M;
        if(M!=0 and (24-(H-8+1)<10) and 60-M<10)
        cout<<"0"<<24-(H-8+1)<<":"<<"0"<<60-M<<endl;       
    }
    return 0;
}

orz


by xhl_leo @ 2024-08-08 15:40:27

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

by linruicong @ 2024-08-08 15:41:45

#include<bits/stdc++.h>
using namespace std;
double s,v,cnt;
int ans,h,m,tmp,tot=8*60+24*60;
int main()
{
    scanf("%lf%lf",&s,&v);
    cnt=s/v;
    tmp=ceil(cnt);
    tmp+=10;
    tot-=tmp;
    if(tot>=24*60) tot-=24*60; 
    h=tot%60;
    tot/=60;
    m=tot;
    printf("%02d:%02d",m,h);
    return 0;
}

by xhl_leo @ 2024-08-08 15:42:00

求关


by linruicong @ 2024-08-08 15:43:24

求关


by linruicong @ 2024-08-08 15:44:21

@xhl_leo,已关


by dhc130223 @ 2024-08-09 21:41:03

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

|