#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int x, d, h, m;
cin >> x >> d >> h >> m;
unordered_map<int, int> roundToEndingDay = {
{1, 24},
{2, 25},
{3, 26},
{4, 27},
{5, 29}
};
int ed = roundToEndingDay[x], eh = 24;
int dd = ed - d;
int md = (dd + 1) * 24 * 60;
md -= ((h * 60) + m);
if (x == 5 && (d < 29 || (h <= 2 && d == 29))) md -= 60;
cout << md << "\n";
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 | #include <iostream> #include <vector> #include <unordered_map> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int x, d, h, m; cin >> x >> d >> h >> m; unordered_map<int, int> roundToEndingDay = { {1, 24}, {2, 25}, {3, 26}, {4, 27}, {5, 29} }; int ed = roundToEndingDay[x], eh = 24; int dd = ed - d; int md = (dd + 1) * 24 * 60; md -= ((h * 60) + m); if (x == 5 && (d < 29 || (h <= 2 && d == 29))) md -= 60; cout << md << "\n"; return 0; } |
English