#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
int res_h = 0, res_m = 0;
int res = 0;
if(x >= 1 && x <= 4) {
res_h = 23 - h;
res_m = 60 - m;
if(d == 22 + x) {
res_h += 24;
}
res = res_h * 60 + res_m;
} else {
res_h = 23 - h + (29 - d) * 24;
res_m = 60 - m;
if(d < 29 || (d == 29 && h < 2)) {
res_h--;
}
res = 60 * res_h + res_m;
}
cout << res << '\n';
return 0;
}
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 29 30 31 32 33 34 35 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int x, d, h, m; cin >> x >> d >> h >> m; int res_h = 0, res_m = 0; int res = 0; if(x >= 1 && x <= 4) { res_h = 23 - h; res_m = 60 - m; if(d == 22 + x) { res_h += 24; } res = res_h * 60 + res_m; } else { res_h = 23 - h + (29 - d) * 24; res_m = 60 - m; if(d < 29 || (d == 29 && h < 2)) { res_h--; } res = 60 * res_h + res_m; } cout << res << '\n'; return 0; } |
English