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
29
30
31
32
33
34
35
36
37
38
#include <iostream>
using namespace std;
int main()
{
    int x, h, d, m;
    cin >> x >> d >> h >> m;
    int publikacja = 22 +x;
    int zakonczenie = publikacja +1;
    int czas;
    if (x <= 4) {
        if (d == publikacja) {
            czas = 2160 - (h - 12) * 60;
        }
        else {
            czas = 1440 - h * 60;
        }
    }
    else {
        zakonczenie += 1;
        if (d == publikacja) {
            czas = 3540 - (h - 12) * 60;
        }
        else if (d == zakonczenie) {
            czas = 1380 - h * 60;
        }
        else {
            czas = 2820 - h * 60;
            
        }

    }
    if (d == 29&&h>2) {
        czas += 60;
    }
    czas -= m;
    cout << czas;
    return 0;
}