#include<bits/stdc++.h>
using namespace std;
int main(){
int x, d, h, m;
cin >> x >> d >> h >> m;
int xx = 0;
if(d == 29 && h > 2)xx = - 60;
d -= (22 + x);
if(x == 5){
if(d == 0)cout << 3540 - ((h - 12) * 60 + m + xx) << '\n';
else if(d == 1)cout << 3540 - (12 * 60 + h * 60 + m + xx) << '\n';
else cout << 3540 - ((12 + 24) * 60 + h * 60 + m + xx) << '\n';
}
else{
if(d == 0){
cout << 2160 - ((h - 12) * 60 + m + xx) << '\n';
}
else cout << 2160 - (12 * 60 + h * 60 + m + xx) << '\n';
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<bits/stdc++.h> using namespace std; int main(){ int x, d, h, m; cin >> x >> d >> h >> m; int xx = 0; if(d == 29 && h > 2)xx = - 60; d -= (22 + x); if(x == 5){ if(d == 0)cout << 3540 - ((h - 12) * 60 + m + xx) << '\n'; else if(d == 1)cout << 3540 - (12 * 60 + h * 60 + m + xx) << '\n'; else cout << 3540 - ((12 + 24) * 60 + h * 60 + m + xx) << '\n'; } else{ if(d == 0){ cout << 2160 - ((h - 12) * 60 + m + xx) << '\n'; } else cout << 2160 - (12 * 60 + h * 60 + m + xx) << '\n'; } } |
English