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 A, B, C, T = 0; while (1) { cin >> A >> B; cin >> C; if (A >= 0 && A <= 23 && B >= 0 && B <= 59 && C >= 0 && C <= 1000) break; } T = (A * 60 + B) + C; if (T < 1440) cout << (T – (T % 60)) / 60 << ” “ << T % 60 << endl; else cout << ((T – 1440) – ((T – 1440) % 60)) / 60 << ” “ << (T – 1440) % 60 << endl; return 0; } | cs |