#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, d, h, m;
cin >> x >> d >> h >> m;
if (x == 5) x = 6;
int res{};
res += 60 * (23 - h) + (60 - m);
if (d - x <= 22) {
res += 24 * 60;
}
if (d - x <= 21) {
res += 24 * 60;
}
if (x == 6 && (d == 27 || d == 28 || (d == 29 && h < 2))) {
res -= 60;
}
cout << res << "\n";
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int x, d, h, m; cin >> x >> d >> h >> m; if (x == 5) x = 6; int res{}; res += 60 * (23 - h) + (60 - m); if (d - x <= 22) { res += 24 * 60; } if (d - x <= 21) { res += 24 * 60; } if (x == 6 && (d == 27 || d == 28 || (d == 29 && h < 2))) { res -= 60; } cout << res << "\n"; } |
English