#include <bits/stdc++.h>
using namespace std;
int main(){
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
int r, d, h, m; cin >> r >> d >> h >> m;
if(r == 5){
int total_time = 59 * 60;
if(d == 29 && h > 2) total_time -= (36 * 60 + (h - 1) * 60 + m);
else if(d == 27) total_time -= ((h - 12) * 60 + m);
else total_time -= ((d - 28) * 24 * 60 + 12 * 60 + h * 60 + m);
cout << total_time;
}
else{
int total_time = 36 * 60;
if(d == 23 + r) total_time -= (12 * 60 + h * 60 + m);
else total_time -= ((h - 12) * 60 + m);
cout << total_time;
}
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 | #include <bits/stdc++.h> using namespace std; int main(){ std::ios_base::sync_with_stdio(0); std::cin.tie(0); int r, d, h, m; cin >> r >> d >> h >> m; if(r == 5){ int total_time = 59 * 60; if(d == 29 && h > 2) total_time -= (36 * 60 + (h - 1) * 60 + m); else if(d == 27) total_time -= ((h - 12) * 60 + m); else total_time -= ((d - 28) * 24 * 60 + 12 * 60 + h * 60 + m); cout << total_time; } else{ int total_time = 36 * 60; if(d == 23 + r) total_time -= (12 * 60 + h * 60 + m); else total_time -= ((h - 12) * 60 + m); cout << total_time; } return 0; } |
English