#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
if (x < 5)
{
int answer = (23 + x - d) * 24 * 60 + (23 - h) * 60 + 60 - m;
cout << answer << '\n';
}
else
{
int answer = (29 - d) * 24 * 60 + (23 - h) * 60 + 60 - m;
if (d < 29 || h < 2) answer -= 60;
cout << answer << '\n';
}
}
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 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int x, d, h, m; cin >> x >> d >> h >> m; if (x < 5) { int answer = (23 + x - d) * 24 * 60 + (23 - h) * 60 + 60 - m; cout << answer << '\n'; } else { int answer = (29 - d) * 24 * 60 + (23 - h) * 60 + 60 - m; if (d < 29 || h < 2) answer -= 60; cout << answer << '\n'; } } |
English