Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string q;
  8. cin >> q;
  9. int h = (q[0]-'0') * 10 + q[1]-'0';
  10. int m = (q[3]-'0') * 10 + q[4]-'0';
  11. int hh, mm;
  12. cin >> hh >> mm;
  13. cout << h << " " << m << endl;
  14. if(h + hh < 10 && m + mm < 10) {cout << 0 << h+hh << ":" << 0 << m+mm; return 0;}
  15.  
  16.  
  17. if(h + hh < 10 && m + mm >= 10) {if(m+mm >= 60) {cout << 0 << h+hh + 1 << ":" << m+mm % 60; return 0;}
  18. cout << h+hh << ":" << 0 << m+mm; return 0;}
  19.  
  20.  
  21. if(h + hh >= 10 && m + mm < 10 ) {if(h + hh >= 24) {cout << (h+hh) % 24 << ":" << 0 << m+mm; return 0;}
  22. cout << h+hh << ":" << 0 << m+mm; return 0;}
  23.  
  24.  
  25. if(h+hh >= 10 && m+mm >= 10) {if(m+mm >= 60) { if((h+hh+1) >= 24)
  26. {cout << 0 << (h+hh + 1) % 24 << ":" << (m+mm) % 60; return 0;}
  27. cout << 0 << h+hh + 1 << ":" << m+mm % 60; return 0;}
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement