1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;

int main() {
    int x, d, h, m;
    cin >> x >> d >> h >> m;

    int end;

    // ustawiamy koniec rundy OD RAZU w minutach
    if (x == 1) end = (24 - 23) * 1440 + 23 * 60 + 59;
    if (x == 2) end = (25 - 23) * 1440 + 23 * 60 + 59;
    if (x == 3) end = (26 - 23) * 1440 + 23 * 60 + 59;
    if (x == 4) end = (27 - 23) * 1440 + 23 * 60 + 59;
    if (x == 5) end = (29 - 23) * 1440 + 23 * 60 + 59;

    // start w minutach
    int start = (d - 23) * 1440 + h * 60 + m;

    int wynik = end - start + 1;

    // najprostsze sprawdzenie zmiany czasu
    if (x == 5 && d <= 28) {
        wynik -= 60;
    }

    cout << wynik;
}