#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <string>
using namespace std;
int main() {
int x, d, h, m;
cin >> x >> d >> h >> m;
int last = x == 5;
int res = (23 + x + last - d) * 24 * 60;
res += (23 - h) * 60;
res += (60 - m);
if (last && (d < 29 || h < 2)) {
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 | #include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> #include <cmath> #include <string> using namespace std; int main() { int x, d, h, m; cin >> x >> d >> h >> m; int last = x == 5; int res = (23 + x + last - d) * 24 * 60; res += (23 - h) * 60; res += (60 - m); if (last && (d < 29 || h < 2)) { res -= 60; } cout << res << endl; return 0; } |
English