1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
using namespace std;
using ll=long long;
int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int x, d, h, m, wyn;
  cin >> x >> d >> h >> m;
  int a[6]={0, 24, 25, 26, 27, 29};
  wyn=1440;
  wyn-=m+60*h;
  wyn+=(a[x]-d)*1440;
  if (x==5 and (d<29 or h<2)) wyn-=60;
  cout << wyn;
}