80pts求调

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

zhouzihao20110917 @ 2023-11-03 18:28:34

#include <bits/stdc++.h>
using namespace std;
int a, b, sum = 0, ans = 8 * 60;

int main() {
    cin >> a >> b;
    if()
    if (a % b == 0) {
        sum += a / b;
    } else {
        sum += a / b + 1;
    }
    if (ans - sum < 0) {
        ans -= sum;
        ans += 1440;
        int s = ans / 60;
        int m = ans - s * 60 - 10 ;
        if (s < 10 && m < 10) {
            cout << "0" << s << ":" << "0" << m;
            return 0;
        }
        if (s < 10 && m > 10) {
            cout << "0" << s << ":" << m;
            return 0;
        }
        if (s > 10 && m < 10) {
            cout << s << ":" << "0" << m;
            return 0;
        } else {
            cout  << s << ":" << m;
        }
    } else {
        ans -= sum;
        int s = ans / 60;
        int m = ans - s * 60 - 10;
        if (s < 10 && m < 10) {
            cout << "0" << s << ":" << "0" << m;
            return 0;
        }
        if (s < 10 && m > 10) {
            cout << "0" << s << ":" << m;
            return 0;
        }
    }
    return 0;
}

|