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

int main() {
    cin.tie(0)->sync_with_stdio(0);
    short x,d,h,m;
    cin>>x>>d>>h>>m;
    auto gettime = [](int d,int h,int m) {
        return d*24*60+h*60+m;
    };
    int timeend[] = {
        0,
        gettime(25, 0, 0),
        gettime(26, 0, 0),
        gettime(27, 0, 0),
        gettime(28, 0, 0),
        gettime(30, 0, 0),
    };
    auto t0 = gettime(d, h, m);
    auto res = timeend[x]-t0;
    if (t0<gettime(29, 3, 0)&&timeend[x]>=gettime(29, 3, 0)) res-=60;
    cout << res << '\n';
}