1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<bits/stdc++.h>
using namespace std;
int main()
{ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int x,d,h,m;
    cin>>x>>d>>h>>m;
    int d2=x+23;
    if(d2 == 28){d2=29;}
    if(x == 5 && ((d == 29 && h<=2) || d<29))
    {
        h++;
    }
    int t1=1440*d + 60*h + m;
    int t2=1440*(d2+1);
    cout<<t2-t1<<endl;
    return 0;
}