#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ll x, d, h, m;
cin >> x >> d >> h >> m;
vector<int> days = {0, 24, 25, 26, 27, 29};
int H = 60;
int D = H * 24;
int res = (days[x] - d) * D;
res += (24 - h) * H;
res += -m * 1;
if(x==5 && (d < 29 || (d==29 && h<2))) res -= H;
cout << res << "\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 | #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef long long ll; using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll x, d, h, m; cin >> x >> d >> h >> m; vector<int> days = {0, 24, 25, 26, 27, 29}; int H = 60; int D = H * 24; int res = (days[x] - d) * D; res += (24 - h) * H; res += -m * 1; if(x==5 && (d < 29 || (d==29 && h<2))) res -= H; cout << res << "\n"; return 0; } |
English