#include <iostream>
#include <map>
using namespace std;
struct Runda
{
int d_pocz, h_pocz, m_pocz, d_kon, h_kon, m_kon;
};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
map<int, Runda> rundy;
rundy[0] = {23, 0, 0, 0, 0, 0};
rundy[1] = {23, 12, 0, 24, 24, 0};
rundy[2] = {24, 12, 0, 25, 24, 0};
rundy[3] = {25, 12, 0, 26, 24, 0};
rundy[4] = {26, 12, 0, 27, 24, 0};
rundy[5] = {27, 12, 0, 29, 24, 0};
int x, d, h, m;
cin >> x >> d >> h >> m;
int start_min;
start_min = (d - rundy[0].d_pocz) * 1440 + h * 60 + m;
if (x < 5 || x == 5 && d == 29 && h > 2)
{
cout << (rundy[x].d_kon - rundy[0].d_pocz) * 1440 + rundy[x].h_kon * 60 + rundy[x].m_kon - start_min << "\n";
}
else
{
cout << (rundy[x].d_kon - rundy[0].d_pocz) * 1440 + rundy[x].h_kon * 60 + rundy[x].m_kon - start_min - 60 << "\n";
}
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 38 39 40 41 42 43 44 45 | #include <iostream> #include <map> using namespace std; struct Runda { int d_pocz, h_pocz, m_pocz, d_kon, h_kon, m_kon; }; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); map<int, Runda> rundy; rundy[0] = {23, 0, 0, 0, 0, 0}; rundy[1] = {23, 12, 0, 24, 24, 0}; rundy[2] = {24, 12, 0, 25, 24, 0}; rundy[3] = {25, 12, 0, 26, 24, 0}; rundy[4] = {26, 12, 0, 27, 24, 0}; rundy[5] = {27, 12, 0, 29, 24, 0}; int x, d, h, m; cin >> x >> d >> h >> m; int start_min; start_min = (d - rundy[0].d_pocz) * 1440 + h * 60 + m; if (x < 5 || x == 5 && d == 29 && h > 2) { cout << (rundy[x].d_kon - rundy[0].d_pocz) * 1440 + rundy[x].h_kon * 60 + rundy[x].m_kon - start_min << "\n"; } else { cout << (rundy[x].d_kon - rundy[0].d_pocz) * 1440 + rundy[x].h_kon * 60 + rundy[x].m_kon - start_min - 60 << "\n"; } return (0); } |
English