#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
auto f = [&](int d, int h, int m) {
return 1440 * d + 60 * h + m;
};
if (x <= 4) {
cout << f(24 + x, 0, 0) - f(d, h, m) << '\n';
}
else {
cout << f(29, 23, 0) - (f(d, h, m) - (d == 29 && h >= 3 ? 60 : 0))<< '\n';
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(0); int x, d, h, m; cin >> x >> d >> h >> m; auto f = [&](int d, int h, int m) { return 1440 * d + 60 * h + m; }; if (x <= 4) { cout << f(24 + x, 0, 0) - f(d, h, m) << '\n'; } else { cout << f(29, 23, 0) - (f(d, h, m) - (d == 29 && h >= 3 ? 60 : 0))<< '\n'; } } |
English