#include <bits/stdc++.h>
using namespace std;
int days[7] = {0, 23, 24, 25, 26, 27, 29};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, d, h, m; cin >> x >> d >> h >> m;
int res = 0;
if (x == 5){
res = 60 * 60 - 60;
if (d == 27){
res -= m;
res -= abs((12 - h)) * 60;
} else if (d == 28){
res -= 12 * 60;
res -= m;
res -= h * 60;
}else{
if (h >= 3)
res += 60;
res -= 36 * 60;
res -= m;
res -= 60 * h;
}
if (res < 0)
cout << 0 << '\n';
else
cout << res << '\n';
return 0;
}
res = 36 * 60;
res -= m;
if (days[x] != d)
res = res - 12 * 60 - h * 60;
else
res -= (h - 12) * 60;
if (res < 0)
cout << 0 << '\n';
else
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 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include <bits/stdc++.h> using namespace std; int days[7] = {0, 23, 24, 25, 26, 27, 29}; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int x, d, h, m; cin >> x >> d >> h >> m; int res = 0; if (x == 5){ res = 60 * 60 - 60; if (d == 27){ res -= m; res -= abs((12 - h)) * 60; } else if (d == 28){ res -= 12 * 60; res -= m; res -= h * 60; }else{ if (h >= 3) res += 60; res -= 36 * 60; res -= m; res -= 60 * h; } if (res < 0) cout << 0 << '\n'; else cout << res << '\n'; return 0; } res = 36 * 60; res -= m; if (days[x] != d) res = res - 12 * 60 - h * 60; else res -= (h - 12) * 60; if (res < 0) cout << 0 << '\n'; else cout << res << '\n'; return 0; } |
English