#include <stdio.h>
int main() {
int x, d, h, m, res=0;
int all_day = 24 * 60;
scanf("%d%d%d%d", &x, &d, &h, &m);
res = 60 * (24 - (h+1)) + 60 - m; // to midnight
if (d == 22 + x) // first day of round
res += all_day;
if (x == 5 && (d == 27 || d == 28))
res += all_day - 60;
if (d == 29 && h <= 2)
res -= 60;
printf("%d\n", res);
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> int main() { int x, d, h, m, res=0; int all_day = 24 * 60; scanf("%d%d%d%d", &x, &d, &h, &m); res = 60 * (24 - (h+1)) + 60 - m; // to midnight if (d == 22 + x) // first day of round res += all_day; if (x == 5 && (d == 27 || d == 28)) res += all_day - 60; if (d == 29 && h <= 2) res -= 60; printf("%d\n", res); return 0; } |
English