第九个测试点过不了,大佬们救救我!!!

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

spring_ninth @ 2024-02-01 22:45:30

#include<stdio.h>
int main()
{
    int x, v, st, t1, t_hour, t_min; // st=sumtime
    scanf("%d %d", &x, &v);
    t1 = x / v;
    st = t1 + 10 + 1;
    if (st < 60)
    {
        printf("07:%02d", 60 - st);
    }
    else
    {
        if (st == 60)
        {
            t_hour = 7 - t_hour + 1;
            t_min = 0;
        }
        else
        {
            t_hour = st / 60;
            for (; st > 60;)
            {
                st -= 60;
            }
            t_hour = 7 - t_hour;
            t_min = 60 - st;
        }
        if (t_min == 60)
        {
            t_hour++;
            t_min = 0;
        }
        if (t_hour >= 0)
        {
            printf("%02d:%02d", t_hour, t_min);
        }
        else
        {
            t_hour = 24 + t_hour;
            printf("%02d:%02d", t_hour, t_min);
        }
    }

    return 0;
}

|