30分WA求调

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

Coder12823 @ 2024-03-10 09:35:48

#include <bits/stdc++.h>
using namespace std;

int main() {
    int s, v;
    scanf("%d%d", &s, &v);
    int time;
    if (s % v == 0) {
        time = s / v;
    } else {
        time = s / v + 1;
    }
    int h = 7, m = 50;
    for (int i = 0; i < time; i++) {
        if (m == 0) {
            h--;
            m = 60;
        } else {
            m--;
        }
    }
    if (h < 0) {
        h = 24 + h;
    }
    printf("%02d:%02d\n", h, m);

    return 0;
}

by Coder12823 @ 2024-03-10 10:17:17

已过,无忧


|