#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define irep(i,a,b) for(int i = a; i >= b; i--)
typedef long long ll;
typedef long double ld;
//typedef __int128 int128;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<ll,ll> pl;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int x,d,h,m;
cin >> x >> d >> h >> m;
int ans = 0;
if(x <= 4){
if(d != 23+x) ans += 24*60;
}
else{
if(d != 29) ans += (29-d)*24*60;
if(d < 29 || (d == 29 && h < 2)) ans -= 60;
}
ans += (24-h-1)*60;
ans += 60-m;
cout << ans << '\n';
return 0;
}
//g++ -O3 -static -Wall .cpp -std=c++17
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 41 42 43 | #include <bits/stdc++.h> using namespace std; #define st first #define nd second #define pb push_back #define rep(i,a,b) for(int i = a; i <= b; i++) #define irep(i,a,b) for(int i = a; i >= b; i--) typedef long long ll; typedef long double ld; //typedef __int128 int128; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pi; typedef pair<double,double> pd; typedef pair<ll,ll> pl; int main(){ ios::sync_with_stdio(0); cin.tie(0); int x,d,h,m; cin >> x >> d >> h >> m; int ans = 0; if(x <= 4){ if(d != 23+x) ans += 24*60; } else{ if(d != 29) ans += (29-d)*24*60; if(d < 29 || (d == 29 && h < 2)) ans -= 60; } ans += (24-h-1)*60; ans += 60-m; cout << ans << '\n'; return 0; } //g++ -O3 -static -Wall .cpp -std=c++17 |
English