1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    long long x,d,h,m;
    cin >> x >> d >> h >> m;
    long long tmstp[30];
    for(int i=24;i<=27;i++){
        tmstp[i-23] = (i+1)*24*60;
    }
    tmstp[5] = 30*24*60;

    long long tmp = d*24*60 + h*60 + m;
    //cout << tmstp[x] << ' ' << tmp << '\n';
    long long wyn = tmstp[x] - tmp;
    if(x==5 and tmp < 41880) wyn-=60;
    cout << wyn << '\n';
    //29 2 00
    //29*24*60 + 2*60
    return 0;
}

//41760