#include<bits/stdc++.h>
using namespace std;
#define int int64_t
const int64_t mod = 1e9+7;
const int maxn = 1e6+10;
int inf;
/*
*/
int x, d, h, m;
void tc()
{
cin >> x >> d >> h >> m;
//cout << "x=" << x << " d=" << d << " h=" << h << " m=" << m << endl;
int ct = (d-23) * 24 * 60 + h * 60 + m;
int et = 0;
if (x <= 4)
{
//cout << "case x<=4" << endl;
et = x * 24 * 60 + 23 * 60 + 59;
}
else if (x == 5)
{
//cout << "case x==5" << endl;
et = (29-23) * 24 * 60 + 23 * 60 + 59;
if (d <= 28 || (d == 29 && h <= 2))
{
//cout << "case before change of time" << endl;
et -= 60;
}
}
//cout << "ct=" << ct << endl;
//cout << "et=" << et << endl;
int ans = et - ct + 1;
cout << ans << endl;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
inf = numeric_limits<int>::max()/2;
int T = 1;
//cin >> T;
while (T--) tc();
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include<bits/stdc++.h> using namespace std; #define int int64_t const int64_t mod = 1e9+7; const int maxn = 1e6+10; int inf; /* */ int x, d, h, m; void tc() { cin >> x >> d >> h >> m; //cout << "x=" << x << " d=" << d << " h=" << h << " m=" << m << endl; int ct = (d-23) * 24 * 60 + h * 60 + m; int et = 0; if (x <= 4) { //cout << "case x<=4" << endl; et = x * 24 * 60 + 23 * 60 + 59; } else if (x == 5) { //cout << "case x==5" << endl; et = (29-23) * 24 * 60 + 23 * 60 + 59; if (d <= 28 || (d == 29 && h <= 2)) { //cout << "case before change of time" << endl; et -= 60; } } //cout << "ct=" << ct << endl; //cout << "et=" << et << endl; int ans = et - ct + 1; cout << ans << endl; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); inf = numeric_limits<int>::max()/2; int T = 1; //cin >> T; while (T--) tc(); return 0; } |
English