3,5测试点一直不过求助qwq

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

Zsm061018 @ 2024-10-11 14:13:59


#include <stdio.h>
#include <math.h>
int main()
{   int p;
    double s,v;
    scanf("%lf%lf",&s,&v);
    p=ceil(s/v)+10;
    if (p<480)
        if (p%60==0)
            printf("%d%d:%d%d",0,8-p/60,0,0);
        else
            printf("%d%d:%d",0,8-p/60-1,60-p%60);
    else 
        if (p%60==0)
            printf("%02d:%d%d",24-p/60+8,0,0);
        else
            printf("%02d:%d",24-p/60+7,60-p%60);
    return 0;   
}
```c

by lovely202402 @ 2024-10-11 20:03:43

有些地方冗杂了删一些就好

#include <stdio.h>
#include <math.h>
int main()
{   int p;
    double s,v;
    scanf("%lf %lf",&s,&v);
    p=ceil(s/v)+10;
    if (p<480){
        printf("%02d:%02d\n", 8-p/60-1, 60-p%60);
    }
    else {
        printf("%02d:%02d\n", 24-p/60+7, 60-p%60);
    }

    return 0;   
}

by Zsm061018 @ 2024-10-12 17:21:46

@lovely202402 感谢感谢


|