#ifdef LOC
#include "debuglib.hpp"
#else
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define deb(...)
#define DBP(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define rep(i, b, e) for (int i = (b); i < (e); i++)
#define each(a, x) for (auto& a : (x))
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
int get(int d, int h, int m) {
int ret = d*24*60 + h*60 + m;
if (make_tuple(d, h, m) > make_tuple(29, 2, 0)) {
ret -= 60;
}
return ret;
}
int main() {
cin.sync_with_stdio(0); cin.tie(0);
cout << fixed << setprecision(12);
int x, d, h, m;
cin >> x >> d >> h >> m;
int end;
if (x == 1) end = get(25, 0, 0);
else if (x == 2) end = get(26, 0, 0);
else if (x == 3) end = get(27, 0, 0);
else if (x == 4) end = get(28, 0, 0);
else if (x == 5) end = get(30, 0, 0);
else assert(0);
int ans = end - get(d, h, m);
cout << ans << '\n';
}
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 | #ifdef LOC #include "debuglib.hpp" #else #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define deb(...) #define DBP(...) #endif using namespace std; using ll = long long; using vi = vector<int>; using pii = pair<int, int>; #define pb push_back #define mp make_pair #define x first #define y second #define rep(i, b, e) for (int i = (b); i < (e); i++) #define each(a, x) for (auto& a : (x)) #define all(x) (x).begin(), (x).end() #define sz(x) int((x).size()) int get(int d, int h, int m) { int ret = d*24*60 + h*60 + m; if (make_tuple(d, h, m) > make_tuple(29, 2, 0)) { ret -= 60; } return ret; } int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(12); int x, d, h, m; cin >> x >> d >> h >> m; int end; if (x == 1) end = get(25, 0, 0); else if (x == 2) end = get(26, 0, 0); else if (x == 3) end = get(27, 0, 0); else if (x == 4) end = get(28, 0, 0); else if (x == 5) end = get(30, 0, 0); else assert(0); int ans = end - get(d, h, m); cout << ans << '\n'; } |
English