1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> using namespace std; int main() { int H, M, T = 0; while (1) { cin >> H >> M; if (H >= 0 && H <= 23 && M >= 0 && M <= 59) break; } T = (H * 60 + M) – 45; if (T >= 0) cout << (T – T % 60) / 60 << ” “ << T % 60 << endl; else cout << ((T + 1440) – ((T + 1440) % 60)) / 60 << ” “ << (T + 1440) % 60 << endl; return 0; } | cs |