一直90分,求助!!!

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

dingxingjian @ 2024-09-19 12:29:01

#include <stdio.h>
#include <math.h>
int main(void)
{
    double s,v,t;
    scanf("%lf %lf",&s,&v);
    t=s/v;
    int time=(int)ceil(t)+10;
    int hour=time/60;
    int minute=time%60;
    int HH=24+8-1-hour;
    int MM=60-minute;
    if (MM==60){
        HH++;
    }
    if (HH>24){
        HH=HH-24;
    }
    printf("%02d:%02d",HH,MM);
    return 0;

}

by andycode @ 2024-09-19 12:33:45

@dingxingjian s/v要向上取整吧


by andycode @ 2024-09-19 12:34:17

搞错了


by andycode @ 2024-09-19 12:40:08

@dingxingjian H>24 改成 H>=24


by dongzirui0817 @ 2024-09-19 12:41:55

@dingxingjian hack:

470 1

by dongzirui0817 @ 2024-09-19 12:42:43

@dingxingjian MM 要模 60


by dingxingjian @ 2024-09-19 14:12:36

@andycode 牛逼,兄弟


|