#include <iostream>
using namespace std;
int dane[5] = {24, 25, 26, 27, 29};
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int x, d, h, m;
cin >> x >> d >> h >> m;
if(x != 5){
if(dane[x-1] != d){
d = 1;
h = (23-h);
m = (60-m);
}else{
d = 0;
h = (23-h);
m = (60-m);
}
}else{
if(d == 27){
d = 2;
h = (23-h)-1;
m = (60-m);
}else if(d == 28){
d = 1;
h = (23-h)-1;
m = (60-m);
}else{
d = 0;
if(h >= 3){
h = (23-h);
m = (60-m);
}else{
h = (23-h)-1;
m = (60-m);
}
}
}
//cout << d << " " << h << " " << m << '\n';
cout << ((d*24*60)+(h*60)+m) << '\n';
}
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 | #include <iostream> using namespace std; int dane[5] = {24, 25, 26, 27, 29}; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int x, d, h, m; cin >> x >> d >> h >> m; if(x != 5){ if(dane[x-1] != d){ d = 1; h = (23-h); m = (60-m); }else{ d = 0; h = (23-h); m = (60-m); } }else{ if(d == 27){ d = 2; h = (23-h)-1; m = (60-m); }else if(d == 28){ d = 1; h = (23-h)-1; m = (60-m); }else{ d = 0; if(h >= 3){ h = (23-h); m = (60-m); }else{ h = (23-h)-1; m = (60-m); } } } //cout << d << " " << h << " " << m << '\n'; cout << ((d*24*60)+(h*60)+m) << '\n'; } |
English