蒟蒻的70分求助

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

514czh @ 2023-11-30 21:41:34

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

    return 0;
}

by 514czh @ 2023-11-30 21:49:18

鱼鱼鱼刚改了一下变90分了

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

    return 0;
}

by Dark_Monarch @ 2023-12-03 15:08:25

@ywz121014 应该能AC


by Dark_Monarch @ 2023-12-03 15:21:45

@wschxz

#include<bits/stdc++.h>
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
    int s,v;
    scanf("%d%d",&s,&v);
    int t_min = ceil(1.0 * s / v) + 10; //向上取整, 分钟为单位 
    int time_sum = 60 * (24 + 8); //时间限制
    int ans = time_sum - t_min;//从0点算,何时出发
    int h = (ans / 60) % 24;
    int min = ans % 60;
    printf("%02d:%02d",h,min);
    return 0;
}

by 514czh @ 2023-12-04 09:43:32

@ywz121014 蟹蟹awa


|