#include <bits/stdc++.h>
using namespace std;
int round_ends[5] = {24, 25, 26, 27, 29};
int main() {
std::ios_base::sync_with_stdio(false);
int x, d, h, m;
cin >> x;
cin >> d >> h >> m;
int time = (round_ends[x - 1] - d) * 24 * 60 + (24 - h - 1) * 60 + (60 - m);
if (x == 5 && (d < 29 || d == 29 && h < 2)) {
time -= 60;
}
cout << time << "\n";
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <bits/stdc++.h> using namespace std; int round_ends[5] = {24, 25, 26, 27, 29}; int main() { std::ios_base::sync_with_stdio(false); int x, d, h, m; cin >> x; cin >> d >> h >> m; int time = (round_ends[x - 1] - d) * 24 * 60 + (24 - h - 1) * 60 + (60 - m); if (x == 5 && (d < 29 || d == 29 && h < 2)) { time -= 60; } cout << time << "\n"; } |
English