#include "bits/stdc++.h"
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
int start = d * 24 * 60 + h * 60 + m;
int end = (24 + x + int(x == 5)) * 60 * 24 - 1;
int ans = end - start + 1;
if (x == 5 && start <= 29 * 24 * 60 + 2 * 60) ans -= 60;
cout << ans << '\n';
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include "bits/stdc++.h" using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, d, h, m; cin >> x >> d >> h >> m; int start = d * 24 * 60 + h * 60 + m; int end = (24 + x + int(x == 5)) * 60 * 24 - 1; int ans = end - start + 1; if (x == 5 && start <= 29 * 24 * 60 + 2 * 60) ans -= 60; cout << ans << '\n'; } |
English