#include <iostream>
using namespace std;
int main() {
int x, d, h, m;
if (!(cin >> x >> d >> h >> m)) return 0;
int dzien_konca;
if (x == 5) {
dzien_konca = 29;
} else {
dzien_konca = d + (d == (22 + x) ? 1 : 0);
dzien_konca = 23 + x;
}
long long calkowite_minuty = 0;
calkowite_minuty += (23 - h) * 60 + (60 - m);
for (int i = d + 1; i <= dzien_konca; ++i) {
if (i == 29) {
calkowite_minuty += 23 * 60;
} else {
calkowite_minuty += 24 * 60;
}
}
cout << calkowite_minuty << endl;
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 | #include <iostream> using namespace std; int main() { int x, d, h, m; if (!(cin >> x >> d >> h >> m)) return 0; int dzien_konca; if (x == 5) { dzien_konca = 29; } else { dzien_konca = d + (d == (22 + x) ? 1 : 0); dzien_konca = 23 + x; } long long calkowite_minuty = 0; calkowite_minuty += (23 - h) * 60 + (60 - m); for (int i = d + 1; i <= dzien_konca; ++i) { if (i == 29) { calkowite_minuty += 23 * 60; } else { calkowite_minuty += 24 * 60; } } cout << calkowite_minuty << endl; return 0; } |
English