#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
#define int int
void solve(){
int x, d, h, m;
cin>>x>>d>>h>>m;
auto f = [](int day, int hour, int minute){
int base = (day - 23) * 1440;
int offset;
if(day < 29){
offset = hour * 60 + minute;
}else{
if(hour <= 1) offset = hour * 60 + minute;
else offset = (hour - 1) * 60 + minute;
}
return base + offset;
};
int s;
if(x < 5){
int kon = 23 + (x - 1) + 2;
s = (kon - 23) * 1440;
}else{
s = 7 * 1440 - 60;
}
int curr = f(d, h, m);
cout<<(s - curr);
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int t; //cin>>t;
t = 1;
while(t-->0){
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 41 42 43 44 | #include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; #define int int void solve(){ int x, d, h, m; cin>>x>>d>>h>>m; auto f = [](int day, int hour, int minute){ int base = (day - 23) * 1440; int offset; if(day < 29){ offset = hour * 60 + minute; }else{ if(hour <= 1) offset = hour * 60 + minute; else offset = (hour - 1) * 60 + minute; } return base + offset; }; int s; if(x < 5){ int kon = 23 + (x - 1) + 2; s = (kon - 23) * 1440; }else{ s = 7 * 1440 - 60; } int curr = f(d, h, m); cout<<(s - curr); } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t; //cin>>t; t = 1; while(t-->0){ solve(); } } |
English