#include <bits/stdc++.h>
using namespace std;
const int ROUND[5] = {36000, 37440, 38880, 40320, 43200};
const int TIME_LEFT_AFTER_CHANGE = 1260;
const int HOUR = 60;
const int DAY = 24 * HOUR;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
int time = d * DAY + h * HOUR + m;
int time_left = ROUND[x - 1] - time;
if (x == 5 && time_left > TIME_LEFT_AFTER_CHANGE) {
time_left -= HOUR;
}
cout << time_left;
}
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 | #include <bits/stdc++.h> using namespace std; const int ROUND[5] = {36000, 37440, 38880, 40320, 43200}; const int TIME_LEFT_AFTER_CHANGE = 1260; const int HOUR = 60; const int DAY = 24 * HOUR; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int x, d, h, m; cin >> x >> d >> h >> m; int time = d * DAY + h * HOUR + m; int time_left = ROUND[x - 1] - time; if (x == 5 && time_left > TIME_LEFT_AFTER_CHANGE) { time_left -= HOUR; } cout << time_left; } |
English