#include <bits/stdc++.h>
using namespace std;
signed main(){
int x, d, h, m;
cin>>x>>d>>h>>m;
int end_d = (x < 5) ? 23 + x : 29;
int minutes = (24 - (h + 1)) * 60 + 60 - m;
minutes += 24 * 60 * (end_d - d);
if((d > 26 && d < 29 && end_d == 29) || (d == 29 && h < 2))
minutes -= 60;
cout<<minutes;
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 | #include <bits/stdc++.h> using namespace std; signed main(){ int x, d, h, m; cin>>x>>d>>h>>m; int end_d = (x < 5) ? 23 + x : 29; int minutes = (24 - (h + 1)) * 60 + 60 - m; minutes += 24 * 60 * (end_d - d); if((d > 26 && d < 29 && end_d == 29) || (d == 29 && h < 2)) minutes -= 60; cout<<minutes; return 0; } |
English