#include <cstdio>
using namespace std;
typedef long long LL;
LL toMinutesPlain(int d, int h, int m) {
return (((LL)d * 24) + h) * 60 + m;
}
LL toMinutes(int d, int h, int m) {
LL res = toMinutesPlain(d, h, m);
return res >= toMinutesPlain(29, 3, 0) ? res - 60 : res;
}
const LL roundEnds[5] = {
toMinutes(25, 0, 0),
toMinutes(26, 0, 0),
toMinutes(27, 0, 0),
toMinutes(28, 0, 0),
toMinutes(30, 0, 0)
};
int main() {
int x, d, h, m; scanf("%d %d %d %d", &x, &d, &h, &m);
printf("%lld\n", roundEnds[x-1] - toMinutes(d, h, m));
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 <cstdio> using namespace std; typedef long long LL; LL toMinutesPlain(int d, int h, int m) { return (((LL)d * 24) + h) * 60 + m; } LL toMinutes(int d, int h, int m) { LL res = toMinutesPlain(d, h, m); return res >= toMinutesPlain(29, 3, 0) ? res - 60 : res; } const LL roundEnds[5] = { toMinutes(25, 0, 0), toMinutes(26, 0, 0), toMinutes(27, 0, 0), toMinutes(28, 0, 0), toMinutes(30, 0, 0) }; int main() { int x, d, h, m; scanf("%d %d %d %d", &x, &d, &h, &m); printf("%lld\n", roundEnds[x-1] - toMinutes(d, h, m)); return 0; } |
English