#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ve vector
#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void solve(){
int x, d, h, m;
cin >> x >> d >> h >> m;
if(x == 5){
if(d == 29 && h > 2){
cout << (24-h)*60-m << "\n";
return;
}
else if(d == 29){
cout << (23-h)*60-m << "\n";
return;
}
cout << 23*60 + (28-d)*24*60 + (24-h)*60 - m << "\n";
return;
}
cout << (23+x-d)*24*60 + (24-h)*60 - m << "\n";
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int T = 1;
// cin >> T;
while(T--) solve();
}
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 32 33 34 35 36 37 38 39 40 | #include <bits/stdc++.h> using namespace std; #define ll long long #define ve vector #define fi first #define se second #define pb push_back #define all(x) begin(x), end(x) typedef pair<int, int> pii; typedef pair<ll, ll> pll; void solve(){ int x, d, h, m; cin >> x >> d >> h >> m; if(x == 5){ if(d == 29 && h > 2){ cout << (24-h)*60-m << "\n"; return; } else if(d == 29){ cout << (23-h)*60-m << "\n"; return; } cout << 23*60 + (28-d)*24*60 + (24-h)*60 - m << "\n"; return; } cout << (23+x-d)*24*60 + (24-h)*60 - m << "\n"; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int T = 1; // cin >> T; while(T--) solve(); } |
English