Advertisement
informaticage

Timer

Mar 25th, 2021
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   int H1, M1, H2, M2;
  5.   std::cin >> H1 >> M1 >> H2 >> M2;
  6.  
  7.   int hoursDiff = 0;
  8.   while (H1 % 24 != H2) {
  9.     hoursDiff++;
  10.     H1++;
  11.   }
  12.  
  13.   int minutesDiff = 0;
  14.   while (M1 % 60 != M2) {
  15.     minutesDiff++;
  16.     M1++;
  17.   }
  18.  
  19.   std::cout << (hoursDiff - (1 * M1 > M2) + 24) % 24 << " " << minutesDiff;
  20.   return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement