第9个测试点过不了,麻烦帮忙看看,非常感谢

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

Lappland_333 @ 2024-01-24 16:25:42

#include<stdio.h>
int main()
{
    int s, t, hour ;
    scanf("%d", &s);
    scanf("%d", &t);
    int time, min;
    time = s / t + 10;
    if (time < 480) {
        hour = (480 - time) / 60;
        min = (480 - time) % 60-1;
    }
    else {
        hour = (1920 - time) / 60;  
        min = (1920 - time) % 60-1;
    }
    printf("%02d:%02d", hour, min);
    return 0;
}

by wsgdsgqq @ 2024-01-24 17:04:17

你应该判断一下路程是否整除速度,如果不整除就+1,而不是在后面的min直接-1


|