#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int x, d, h, m;
if (!(cin >> x >> d >> h >> m)) return 0;
int start_mins = (d - 23) * 24 * 60 + h * 60 + m;
if (d == 29 && h >= 3)
start_mins -= 60;
int end_day[] = {0, 25, 26, 27, 28, 30};
int end_mins = (end_day[x] - 23) * 24 * 60;
if (end_day[x] >= 30)
end_mins -= 60;
cout << end_mins - start_mins << "\n";
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int x, d, h, m; if (!(cin >> x >> d >> h >> m)) return 0; int start_mins = (d - 23) * 24 * 60 + h * 60 + m; if (d == 29 && h >= 3) start_mins -= 60; int end_day[] = {0, 25, 26, 27, 28, 30}; int end_mins = (end_day[x] - 23) * 24 * 60; if (end_day[x] >= 30) end_mins -= 60; cout << end_mins - start_mins << "\n"; return 0; } |
English