#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
LL x, d, h, m;
cin >> x >> d >> h >> m;
LL time = -1;
if (x == 1) {
time = (24LL-d) * 24LL * 60LL;
time += (23LL-h) * 60LL;
time += (59LL-m);
} else if (x == 2) {
time = (25LL-d) * 24LL * 60LL;
time += (23LL-h) * 60LL;
time += (59LL-m);
} else if (x == 3) {
time = (26LL-d) * 24LL * 60LL;
time += (23LL-h) * 60LL;
time += (59LL-m);
} else if (x == 4) {
time = (27LL-d) * 24LL * 60LL;
time += (23LL-h) * 60LL;
time += (59LL-m);
} else if (x == 5) {
time = (29LL-d) * 24LL * 60LL;
time += (23LL-h) * 60LL;
time += (59LL-m);
if (d != 29LL || h <= 2LL) {
time -= 60LL;
}
}
cout << time + 1LL << '\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 | #include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); LL x, d, h, m; cin >> x >> d >> h >> m; LL time = -1; if (x == 1) { time = (24LL-d) * 24LL * 60LL; time += (23LL-h) * 60LL; time += (59LL-m); } else if (x == 2) { time = (25LL-d) * 24LL * 60LL; time += (23LL-h) * 60LL; time += (59LL-m); } else if (x == 3) { time = (26LL-d) * 24LL * 60LL; time += (23LL-h) * 60LL; time += (59LL-m); } else if (x == 4) { time = (27LL-d) * 24LL * 60LL; time += (23LL-h) * 60LL; time += (59LL-m); } else if (x == 5) { time = (29LL-d) * 24LL * 60LL; time += (23LL-h) * 60LL; time += (59LL-m); if (d != 29LL || h <= 2LL) { time -= 60LL; } } cout << time + 1LL << '\n'; return 0; } |
English