70分求助

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

sfqxx1 @ 2023-10-03 18:28:29

rt

#include <stdio.h>

int main(void) {

    size_t s, v; scanf("%zu%zu", &s, &v);

    size_t m = s / v;

    if(s % v != 0) ++m;

    m += 10;

    size_t h = m / 60;

    m %= 60;

    size_t rh = 8 - h, rm = 60 - m;

    if(rm != 0) --rh;

    printf("%.2zu:%.2zu\n", rh, rm);

    return 0;

}

by Jianbing_Juan @ 2023-10-03 18:29:28

没考虑昨天出门的情况。@sfqxx1


by sfqxx1 @ 2023-10-03 18:30:02

@Jianbing_Juan OK


|