求解,90

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

lryjs @ 2024-10-24 22:12:11

#include<stdio.h>
int main()
{
    int s,t,v,h=8,m=0;
    scanf("%d%d",&s,&v);
    if (s % v != 0)
        t = s / v + 1;
    else
        t = s / v;
    while (m < (t + 10))
    {
        h--;
        m += 60;
        if (h == 0)
            h = 24;
    }
    m = m -( t+ 10);
    if(h<10&&m>=10)
    printf("0%d:%d\n",h, m);
    else if(h>=10&&m<10)
        printf("%d:0%d\n", h, m);
    else if(h<10&&m<10)
        printf("0%d:0%d\n",h,m);
    else
        printf("%d:%d\n", h, m);
    return 0;
}

|