fork(3) download
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5. void wyswietl(int , int, char);
  6.  
  7. int main()
  8. {
  9. int test=0;
  10. int h,m = {0};
  11. char t;
  12. int temp=0;
  13. cin>>test;
  14. for(int i = 0; i < test ; i++)
  15. {
  16. cin>>h>>t>>m;
  17. if(h==0 && m!=0)
  18. {
  19. h++;
  20. m=0;
  21. wyswietl(h,m,t);
  22. continue;
  23. }
  24. else if(h == 0 && m == 0)
  25. {
  26. wyswietl(h,m,t);
  27. continue;
  28. }
  29. else
  30. {
  31. do
  32. {
  33. m++;
  34. if(m > 59)
  35. {
  36. m=0;
  37. h++;
  38. if(h>23)
  39. {
  40. h=0;
  41. break;
  42. }
  43. }
  44. }while(m % h != 0);
  45. }
  46. wyswietl(h,m,t);
  47. }
  48. return 0;
  49. }
  50.  
  51. void wyswietl(int h, int m, char t)
  52. {
  53. if(h < 10 && m > 10)
  54. {
  55. cout << 0 << h << t << m << endl;
  56. }
  57. else if((h < 10 && m < 10) && m > 0)
  58. {
  59. cout << 0 << h << t << 0 << m <<endl;
  60. }
  61. else if((m < 10) && h > 10)
  62. {
  63. cout << h << t << 0 << m << endl;
  64. }
  65. else if (h < 10 && m == 0)
  66. {
  67. cout << 0 << h << t << 0 << 0 << endl;
  68. }
  69. else if ( m == 0)
  70. {
  71. cout << h << t << 0 << 0 << endl;
  72. }
  73. else
  74. {
  75. cout << h << t << m << endl;
  76. }
  77. }
  78.  
Success #stdin #stdout 0s 4252KB
stdin
5
00:00
12:12
18:42
13:37
23:58
stdout
00:00
12:24
18:54
13:39
00:00