#include <bits/stdc++.h>
using namespace std;
int endofround[6];
int elapsetimetoendofday(const int d, const int h, const int m) {
if (d == 29 && h == 0) return 1380 - m;
if (d == 29 && h == 1) return 1320 - m;
return (23 - h) * 60 + (60 - m);
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int x, d, h, m; cin >> x >> d >> h >> m;
endofround[1] = 24;
endofround[2] = 25;
endofround[3] = 26;
endofround[4] = 27;
endofround[5] = 29;
int sum = 0;
for (int i = d; i <= endofround[x]; ++i) {
sum += elapsetimetoendofday(i, h, m);
h = 0;
m = 0;
}
cout << sum << "\n";
}
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 | #include <bits/stdc++.h> using namespace std; int endofround[6]; int elapsetimetoendofday(const int d, const int h, const int m) { if (d == 29 && h == 0) return 1380 - m; if (d == 29 && h == 1) return 1320 - m; return (23 - h) * 60 + (60 - m); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int x, d, h, m; cin >> x >> d >> h >> m; endofround[1] = 24; endofround[2] = 25; endofround[3] = 26; endofround[4] = 27; endofround[5] = 29; int sum = 0; for (int i = d; i <= endofround[x]; ++i) { sum += elapsetimetoendofday(i, h, m); h = 0; m = 0; } cout << sum << "\n"; } |
English