#include <iostream>
struct Round {
int id;
int start_day;
int start_hour;
int start_minute;
int end_day;
int end_hour;
int end_minute;
} rounds[] = {
{1, 23, 12, 0, 25, 0, 0},
{2, 24, 12, 0, 26, 0, 0},
{3, 25, 12, 0, 27, 0, 0},
{4, 26, 12, 0, 28, 0, 0},
{5, 27, 12, 0, 30, 0, 0},
};
#define TIMECHANGE (29 * 24 * 60 + 2 * 60 + 30)
int compute(int x, int d, int h, int m)
{
struct Round *r = &rounds[x-1];
int t_end = r->end_day * 24 * 60 + r->end_hour * 60 + r->end_minute;
int t = d * 24 * 60 + h * 60 + m;
if (t < TIMECHANGE && t_end > TIMECHANGE)
t += 60;
return t_end - t;
}
int main()
{
int x, d, h, m;
std::cin >> x >> d >> h >> m;
std::cout << compute(x, d, h, m) << std::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 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include <iostream> struct Round { int id; int start_day; int start_hour; int start_minute; int end_day; int end_hour; int end_minute; } rounds[] = { {1, 23, 12, 0, 25, 0, 0}, {2, 24, 12, 0, 26, 0, 0}, {3, 25, 12, 0, 27, 0, 0}, {4, 26, 12, 0, 28, 0, 0}, {5, 27, 12, 0, 30, 0, 0}, }; #define TIMECHANGE (29 * 24 * 60 + 2 * 60 + 30) int compute(int x, int d, int h, int m) { struct Round *r = &rounds[x-1]; int t_end = r->end_day * 24 * 60 + r->end_hour * 60 + r->end_minute; int t = d * 24 * 60 + h * 60 + m; if (t < TIMECHANGE && t_end > TIMECHANGE) t += 60; return t_end - t; } int main() { int x, d, h, m; std::cin >> x >> d >> h >> m; std::cout << compute(x, d, h, m) << std::endl; return 0; } |
English