fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int G,M,S;
  7. cin>>G>>M>>S;
  8.  
  9. if(S==59){
  10. S=0;
  11. if(M==59){
  12. M=0;
  13. if(G==59){
  14. G=0;
  15. }
  16. else{
  17. G++;
  18. }
  19. }
  20. else{
  21. M++;
  22. }
  23. }
  24. else{
  25. S++;
  26. }
  27.  
  28.  
  29. if (G > 10 || M > 10 || S > 10) {
  30. cout << G << ":" << M << ":" << S;
  31. }
  32. else if (G < 10 || M > 10 || S > 10) {
  33. cout << "0" << G << ":" << M << ":" << S;
  34. }
  35. else if (G > 10 || M < 10 || S > 10) {
  36. cout << G << ":" << "0" << M << ":" << S;
  37. }
  38. else {
  39. cout << G << ":" << M << ":" << "0" << S;
  40. }
  41. return 0;
  42. }
Success #stdin #stdout 0.01s 5280KB
stdin
2 59 59
stdout
03:0:0