Relógio

Problem Link

Solution by TioPatinhas100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, M, S, T;
    cin >> H >> M >> S >> T;
    S = S + T;
    while (S >= 60) {
        M++;
        S -= 60;
    }
    while (M >= 60) {
        H++;
        M -= 60;
    }
    while (H >= 24) {
        H -= 24;
    }
    cout << H << endl << M << endl << S;
}

Last updated 1 month, 2 weeks ago


« Back to problem