#include <iostream>
using namespace std;
int main()
{
int minutyZwyklej = 2160;
int nieZwykla = 3540;
int x, d, h, m;
cin >> x >> d >> h >> m;
int laczna = 0;
int pozostaly = 0;
if (x == 5) {
if (d == 27)
{
h = h - 12;
}
else if (d == 28){
h = h + 12;
}
else {
int korekta = (h >= 3) ? 1 : 0;
h = (h - korekta) + 36;
}
laczna = h * 60 + m;
pozostaly = nieZwykla - laczna;
}
else {
if ((d == 23 && x == 1) || (d == 24 && x == 2) || (d == 25 && x == 3) || (d == 26 && x == 4))
h = h - 12;
else {
h = h + 12;
}
laczna = h * 60 + m;
pozostaly = minutyZwyklej - laczna;
}
cout << pozostaly;
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 27 28 29 30 31 32 33 34 35 36 37 | #include <iostream> using namespace std; int main() { int minutyZwyklej = 2160; int nieZwykla = 3540; int x, d, h, m; cin >> x >> d >> h >> m; int laczna = 0; int pozostaly = 0; if (x == 5) { if (d == 27) { h = h - 12; } else if (d == 28){ h = h + 12; } else { int korekta = (h >= 3) ? 1 : 0; h = (h - korekta) + 36; } laczna = h * 60 + m; pozostaly = nieZwykla - laczna; } else { if ((d == 23 && x == 1) || (d == 24 && x == 2) || (d == 25 && x == 3) || (d == 26 && x == 4)) h = h - 12; else { h = h + 12; } laczna = h * 60 + m; pozostaly = minutyZwyklej - laczna; } cout << pozostaly; return 0; } |
English