#include <bits/stdc++.h>
#define int ll
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define vec vector
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
void slv(){
int r,d,h,m;
cin>>r>>d>>h>>m;
int ans=0;
if(r!=5){
int total=36*60;
int s=h*60+m;
if(r==1 and d==24){
s+=24*60;
}
if(r==2 and d==25){
s+=24*60;
}
if(r==3 and d==26){
s+=24*60;
}
if(r==4 and d==27){
s+=24*60;
}
s-=12*60;
ans=total-s;
}else{
int total=(36+24)*60;
int s=h*60+m;
s-=12*60;
if(d>=28){
s+=24*60;
}
if(d==29){
s+=24*60;
}
if(!(d==29 and h>=2)){
s+=60;
}
ans=total-s;
}
cout<<ans<<"\n";
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0);
int t;
t=1;
// cin>>t;
rep(cs,t){
slv();
}
}
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <bits/stdc++.h> #define int ll using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define rng(i,c,n) for(int i=c;i<n;i++) #define fi first #define se second #define vec vector #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pii; void print(){cout<<'\n';} template<class h,class...t> void print(const h&v,const t&...u){cout<<v<<' ',print(u...);} void slv(){ int r,d,h,m; cin>>r>>d>>h>>m; int ans=0; if(r!=5){ int total=36*60; int s=h*60+m; if(r==1 and d==24){ s+=24*60; } if(r==2 and d==25){ s+=24*60; } if(r==3 and d==26){ s+=24*60; } if(r==4 and d==27){ s+=24*60; } s-=12*60; ans=total-s; }else{ int total=(36+24)*60; int s=h*60+m; s-=12*60; if(d>=28){ s+=24*60; } if(d==29){ s+=24*60; } if(!(d==29 and h>=2)){ s+=60; } ans=total-s; } cout<<ans<<"\n"; } signed main(){ ios::sync_with_stdio(0),cin.tie(0); int t; t=1; // cin>>t; rep(cs,t){ slv(); } } |
English