1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// Zadanie Zmiana czasu
// Potyczki algorytmiczne 2026
#include <iostream>
using namespace std;

int main()
{
  unsigned int x, d, h, m;
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL); 
  int tstart, tend, t;
  unsigned int dend[] = {0, 24, 25, 26, 27, 29};
  cin >> x >> d >> h >> m;
  tstart = m + h * 60 + d * 60 * 24; // Czas w min. od pewnego punktu
  tend = (dend[x] + 1) * 60 * 24;
  t = tend - tstart;
  if (x == 5 && (d < 29 || (d == 29 && h < 2)))
    t -= 60;
  cout << t << endl;
  // system("pause"); 
}