#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int x, d, h, m;
cin >> x >> d >> h >> m;
if (x <= 4) {
int end = ((23 + x) * 24 + 23) * 60 + 59 + 1;
int cur = ((d * 24) + h) * 60 + m;
cout << end - cur << "\n";
}
else {
int end = ((23 + x + 1) * 24 + 23) * 60 + 59 + 1;
int cur = ((d * 24) + h) * 60 + m;
int pen = (d <= 28 || (d == 29 && h < 2)) * 60;
cout << end - cur - pen << "\n";
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int x, d, h, m; cin >> x >> d >> h >> m; if (x <= 4) { int end = ((23 + x) * 24 + 23) * 60 + 59 + 1; int cur = ((d * 24) + h) * 60 + m; cout << end - cur << "\n"; } else { int end = ((23 + x + 1) * 24 + 23) * 60 + 59 + 1; int cur = ((d * 24) + h) * 60 + m; int pen = (d <= 28 || (d == 29 && h < 2)) * 60; cout << end - cur - pen << "\n"; } } |
English