#include <iostream>
using namespace std;
int main() {
const int D = 24 * 60;
const int H = 60;
const int M = 1;
long long x, d, h, m;
long long time = 0;
cin >> x >> d >> h >> m;
time = d * D + h * H + m * M;
switch (x) {
case 1:
cout << 25 * D - time;
break;
case 2:
cout << 26 * D - time;
break;
case 3:
cout << 27 * D - time;
break;
case 4:
cout << 28 * D - time;
break;
case 5:
if (time < 29 * D + 2 * H) {
time += H;
}
cout << 30 * D - time;
break;
}
}
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 | #include <iostream> using namespace std; int main() { const int D = 24 * 60; const int H = 60; const int M = 1; long long x, d, h, m; long long time = 0; cin >> x >> d >> h >> m; time = d * D + h * H + m * M; switch (x) { case 1: cout << 25 * D - time; break; case 2: cout << 26 * D - time; break; case 3: cout << 27 * D - time; break; case 4: cout << 28 * D - time; break; case 5: if (time < 29 * D + 2 * H) { time += H; } cout << 30 * D - time; break; } } |
English