#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x;
cin >> x;
int d;
cin >> d;
int h;
cin >> h;
int m;
cin >> m;
int endDay = x == 5 ? 29 : x + 23;
int result = 0;
if (d < endDay) {
result += (endDay - d) * 24 * 60;
}
result += (24 - h) * 60 - m;
if (x == 5 && (d < endDay || h < 3)) {
result -= 60;
}
cout << result;
}
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 | #include <iostream> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int x; cin >> x; int d; cin >> d; int h; cin >> h; int m; cin >> m; int endDay = x == 5 ? 29 : x + 23; int result = 0; if (d < endDay) { result += (endDay - d) * 24 * 60; } result += (24 - h) * 60 - m; if (x == 5 && (d < endDay || h < 3)) { result -= 60; } cout << result; } |
English