#include <iostream>
using namespace std;
int main() {
int x, d, h, m; cin >> x >> d >> h >> m;
int res = 0;
if (x < 5) {
res = ((x + 24 - d) * 24 - h) * 60 - m;
} else {
res = ((x + 25 - d) * 24 - h) * 60 - m;
if (d < 29 || (d == 29 && h < 2)) res -= 60;
}
cout << res << '\n';
return 0;
}
/*
1 23 12 30
5 28 13 14
3 25 12 30
*/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> using namespace std; int main() { int x, d, h, m; cin >> x >> d >> h >> m; int res = 0; if (x < 5) { res = ((x + 24 - d) * 24 - h) * 60 - m; } else { res = ((x + 25 - d) * 24 - h) * 60 - m; if (d < 29 || (d == 29 && h < 2)) res -= 60; } cout << res << '\n'; return 0; } /* 1 23 12 30 5 28 13 14 3 25 12 30 */ |
English