#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int x, d, h, m;
int res = 0;
cin >> x >> d >> h >> m;
int d_left = 23 - d + x;
int h_left = 23 - h;
int m_left = 60 - m;
if (x == 5) {
d_left++;
if (d < 29 || h < 2) {
h_left--;
}
}
res += d_left * 1440;
res += h_left * 60;
res += m_left;
cout << res;
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 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int x, d, h, m; int res = 0; cin >> x >> d >> h >> m; int d_left = 23 - d + x; int h_left = 23 - h; int m_left = 60 - m; if (x == 5) { d_left++; if (d < 29 || h < 2) { h_left--; } } res += d_left * 1440; res += h_left * 60; res += m_left; cout << res; return 0; } |
English