//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
using i128=__int128_t;
void die(string S){puts(S.c_str());exit(0);}
int get(int a,int b,int c)
{
return a*24*60+b*60+c;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int x,d,h,m;
cin>>x>>d>>h>>m;
int fn[]={-1,25,26,27,28,30};
int nd=get(fn[x],0,0);
int cur=get(d,h,m);
if(x==5&&nd-cur>=22*60) nd-=60;
cout<<nd-cur<<'\n';
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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | //Author: Kevin #include<bits/stdc++.h> //#pragma GCC optimize("O2") using namespace std; #define pb emplace_back #define mp make_pair #define ALL(x) (x).begin(),(x).end() #define rALL(x) (x).rbegin(),(x).rend() #define srt(x) sort(ALL(x)) #define rev(x) reverse(ALL(x)) #define rsrt(x) sort(rALL(x)) #define sz(x) (int)(x.size()) #define inf 0x3f3f3f3f #define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin()) #define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin()) #define uni(v) v.resize(unique(ALL(v))-v.begin()) using ll=long long; using ull=unsigned long long; using pii=pair<int,int>; using i128=__int128_t; void die(string S){puts(S.c_str());exit(0);} int get(int a,int b,int c) { return a*24*60+b*60+c; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int x,d,h,m; cin>>x>>d>>h>>m; int fn[]={-1,25,26,27,28,30}; int nd=get(fn[x],0,0); int cur=get(d,h,m); if(x==5&&nd-cur>=22*60) nd-=60; cout<<nd-cur<<'\n'; return 0; } |
English