#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
struct debug {
template <class c>
debug& operator<<(const c&) { return *this; }
};
#define imie(...) ""
#endif
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
int R(int a, int b) {
static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
return uniform_int_distribution<int>(a, b)(rng);
}
constexpr int ALPHA = 26;
int czas_w_minutach(int d, int h, int m) {
return (d * 24 + h) * 60 + m;
}
int koniec_rundy(int x) {
if (x == 1) return czas_w_minutach(24, 23, 59);
if (x == 2) return czas_w_minutach(25, 23, 59);
if (x == 3) return czas_w_minutach(26, 23, 59);
if (x == 4) return czas_w_minutach(27, 23, 59);
assert(x == 5);
return czas_w_minutach(29, 23, 59);
}
void solve(int tc) {
int x, d, h, m;
cin >> x >> d >> h >> m;
int minut = koniec_rundy(x) - czas_w_minutach(d, h, m) + 1;
if (x == 5 && (d < 29 || (d == 29 && h < 2))) minut -= 60;
cout << minut << "\n";
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tests = 1;
debug() << imie(tests);
vector<vector<int>> v = {{2, 1, 3, 7}};
for (int tc = 1; tc <= tests; tc++) {
solve(tc);
debug() << imie(v);
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; #ifdef LOCAL #include "debug.h" #else struct debug { template <class c> debug& operator<<(const c&) { return *this; } }; #define imie(...) "" #endif using ll = long long; using ld = long double; using pii = pair<int, int>; int R(int a, int b) { static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); return uniform_int_distribution<int>(a, b)(rng); } constexpr int ALPHA = 26; int czas_w_minutach(int d, int h, int m) { return (d * 24 + h) * 60 + m; } int koniec_rundy(int x) { if (x == 1) return czas_w_minutach(24, 23, 59); if (x == 2) return czas_w_minutach(25, 23, 59); if (x == 3) return czas_w_minutach(26, 23, 59); if (x == 4) return czas_w_minutach(27, 23, 59); assert(x == 5); return czas_w_minutach(29, 23, 59); } void solve(int tc) { int x, d, h, m; cin >> x >> d >> h >> m; int minut = koniec_rundy(x) - czas_w_minutach(d, h, m) + 1; if (x == 5 && (d < 29 || (d == 29 && h < 2))) minut -= 60; cout << minut << "\n"; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tests = 1; debug() << imie(tests); vector<vector<int>> v = {{2, 1, 3, 7}}; for (int tc = 1; tc <= tests; tc++) { solve(tc); debug() << imie(v); } } |
English