#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
auto get = [&](int dd, int hh, int mm) {
int tot = (dd - 23) * 24 * 60 + hh * 60 + mm;
if(dd == 29 && hh >= 3) tot -= 60;
else if(dd > 29) tot -= 60;
return tot;
};
int x, d, h, m; cin >> x >> d >> h >> m;
int ed_d, ed_h, ed_m;
ed_d = 24 + x + (x == 5), ed_h = 0, ed_m = 0;
cout << get(ed_d, ed_h, ed_m) - get(d, h, m);
}
signed main() {
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
// For Problem with file IO
// #ifndef CPH
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
// #endif
int t = 1;
// cin >> t;
while(t--) {
solve();
}
return 0;
}
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 | #include<bits/stdc++.h> using namespace std; #define int long long void solve() { auto get = [&](int dd, int hh, int mm) { int tot = (dd - 23) * 24 * 60 + hh * 60 + mm; if(dd == 29 && hh >= 3) tot -= 60; else if(dd > 29) tot -= 60; return tot; }; int x, d, h, m; cin >> x >> d >> h >> m; int ed_d, ed_h, ed_m; ed_d = 24 + x + (x == 5), ed_h = 0, ed_m = 0; cout << get(ed_d, ed_h, ed_m) - get(d, h, m); } signed main() { ios::sync_with_stdio(false); ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); // For Problem with file IO // #ifndef CPH // freopen(".in", "r", stdin); // freopen(".out", "w", stdout); // #endif int t = 1; // cin >> t; while(t--) { solve(); } return 0; } |
English