#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int x, d, h, m;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> x >> d >> h >> m;
ll dd = x == 5 ? 29 : x+23;
ll sm = 1LL*(d-23)*1440+h*60+m;
ll dm = 1LL*(dd-23+1)*1440;
ll ch = 1LL*(29-23)*1440+120;
ll diff = dm - sm;
if(sm < ch && ch <= dm) diff -= 60;
cout << diff << '\n';
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include "bits/stdc++.h" using namespace std; using ll = long long; int x, d, h, m; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> x >> d >> h >> m; ll dd = x == 5 ? 29 : x+23; ll sm = 1LL*(d-23)*1440+h*60+m; ll dm = 1LL*(dd-23+1)*1440; ll ch = 1LL*(29-23)*1440+120; ll diff = dm - sm; if(sm < ch && ch <= dm) diff -= 60; cout << diff << '\n'; } |
English