#include <cstdio>
// wszystko wg czasu zimowego
int minutes(int d, int h = 0, int m = 0)
{
int hours = d * 24 + h;
if (d > 29 || (d == 29 && h >= 3)) {
--hours;
}
return 60 * hours + m;
}
int main()
{
int x, d, h, m;
scanf("%d%d%d%d", &x, &d, &h, &m);
int dE = 24 + x;
if (x == 5) ++dE;
printf("%d\n", minutes(dE) - minutes(d, h, m));
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <cstdio> // wszystko wg czasu zimowego int minutes(int d, int h = 0, int m = 0) { int hours = d * 24 + h; if (d > 29 || (d == 29 && h >= 3)) { --hours; } return 60 * hours + m; } int main() { int x, d, h, m; scanf("%d%d%d%d", &x, &d, &h, &m); int dE = 24 + x; if (x == 5) ++dE; printf("%d\n", minutes(dE) - minutes(d, h, m)); } |
English