#include<bits/stdc++.h>
using namespace std;
int ENDS[5] = {24, 25, 26, 27, 29};
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int x, d, h, m;
cin >> x >> d >> h >> m;
int end = ENDS[x-1];
int days = end - d;
int hours = 23 - h;
int minutes = 60 - m;
int missing_hour = 0;
if (x == 5) {
if (d >= 29 && h >= 3) {
missing_hour = 0;
} else {
missing_hour = 60;
}
}
cout << 1440 * days + 60 * hours + minutes - missing_hour;
}
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 | #include<bits/stdc++.h> using namespace std; int ENDS[5] = {24, 25, 26, 27, 29}; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int x, d, h, m; cin >> x >> d >> h >> m; int end = ENDS[x-1]; int days = end - d; int hours = 23 - h; int minutes = 60 - m; int missing_hour = 0; if (x == 5) { if (d >= 29 && h >= 3) { missing_hour = 0; } else { missing_hour = 60; } } cout << 1440 * days + 60 * hours + minutes - missing_hour; } |
English