#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
if (x < 5) {
cout << (23 + x - d) * 24 * 60 + (23 - h) * 60 + 60 - m << endl;
} else {
int result = (29 - d) * 24 * 60 + (23 - h) * 60 + 60 - m;
if (d < 29 || d == 29 && h < 2) {
result-=60;
}
cout << result << endl;
}
}
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 main() { ios_base::sync_with_stdio(0); int x, d, h, m; cin >> x >> d >> h >> m; if (x < 5) { cout << (23 + x - d) * 24 * 60 + (23 - h) * 60 + 60 - m << endl; } else { int result = (29 - d) * 24 * 60 + (23 - h) * 60 + 60 - m; if (d < 29 || d == 29 && h < 2) { result-=60; } cout << result << endl; } } |
English