#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
int endTimes[] = {2880, 4320, 5760, 7200, 10020}; //{2160, 3600, 7200, 10800, 12180};
int dayStartTimes[] = {0, 1440, 2880, 4320, 5760, 7200, 8640};
int x, d, h, m;
int main()
{
ios::sync_with_stdio(0);
cin >> x >> d >> h >> m;
int res = endTimes[x-1] - (dayStartTimes[d-23] + 60*h + m);
if(d >= 29 && h >= 3) {
res += 60;
}
cout << res << endl;
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 | #include <bits/stdc++.h> using namespace std; typedef long long int LL; int endTimes[] = {2880, 4320, 5760, 7200, 10020}; //{2160, 3600, 7200, 10800, 12180}; int dayStartTimes[] = {0, 1440, 2880, 4320, 5760, 7200, 8640}; int x, d, h, m; int main() { ios::sync_with_stdio(0); cin >> x >> d >> h >> m; int res = endTimes[x-1] - (dayStartTimes[d-23] + 60*h + m); if(d >= 29 && h >= 3) { res += 60; } cout << res << endl; return 0; } |
English