#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, d, h, m;
cin >> x >> d >> h >> m;
int ans = (24 * 60) - ((h * 60) + m);
if ((22 + x) == d || (x == 5 && d == 28)) {
ans += 24 * 60;
}
if (x == 5 && d == 27) {
ans += 24 * 60;
}
if (x == 5 && (d < 29 || (d == 29 && h < 2))) {
ans -= 60;
}
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 | #include <bits/stdc++.h> using namespace std; using i64 = int64_t; using u64 = uint64_t; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int x, d, h, m; cin >> x >> d >> h >> m; int ans = (24 * 60) - ((h * 60) + m); if ((22 + x) == d || (x == 5 && d == 28)) { ans += 24 * 60; } if (x == 5 && d == 27) { ans += 24 * 60; } if (x == 5 && (d < 29 || (d == 29 && h < 2))) { ans -= 60; } cout << ans << "\n"; } |
English