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