// UVa 11677 - Alarm Clock #include <iostream> using namespace std; int toMinutes(int h, int m) { return h * 60 + m; } int main() { int h1, m1, h2, m2; while (cin >> h1 >> m1 >> h2 >> m2 && (h1 || m1 || h2 || m2)) { int currentTime = toMinutes(h1, m1); int alarmTime = toMinutes(h2, m2); if (alarmTime < currentTime) alarmTime += 24 * 60; cout << alarmTime - currentTime << endl; } return 0; }
No comments:
Post a Comment