fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int ile,gg,ggm,mm,om=0,og=0;
  6. cin >> ile;
  7. string godz;
  8. getline(cin,godz);
  9. for(int i=0;i<ile;i++)
  10. {
  11. om=0;
  12. getline(cin,godz);
  13. gg=(int)(godz[0]-48)*10+(int)(godz[1]-48);
  14. ggm=(int)(godz[0]-48)*1000+(int)(godz[1]-48)*100+(int)(godz[3]-48)*10+(int)(godz[4]-48)+1;
  15. mm=(int)(godz[3]-48)*10+(int)(godz[4]-48)+1;
  16.  
  17. if(gg==0)
  18. {
  19. if(mm>9)
  20. {
  21. om=(mm/10)+((mm%10)*10);
  22. while(om!=mm)
  23. {
  24. mm++;
  25. if(mm>60){gg++;mm=0;}
  26. om=(mm/10)+((mm%10)*10);
  27. }
  28. }
  29.  
  30. }
  31. else
  32. {
  33. ggm=(gg/10)*1000+(gg%10)*100+mm;
  34. og=(gg/10)+(gg%10)*10+(mm/10)*100+((mm%10)*1000);
  35. while(og!=ggm)
  36. {
  37. mm++;
  38. if(mm>60){gg++;mm=0;}
  39. if(gg==24)gg=0;
  40. ggm=(gg/10)*1000+(gg%10)*100+mm;
  41. og=(gg/10)+(gg%10)*10+(mm/10)*100+((mm%10)*1000);
  42. }
  43. }
  44. if(gg<10) cout<<"0"<<gg;
  45. else cout << gg;
  46. if(mm<10) cout<<":0"<<mm<<endl;
  47. else cout <<":"<<mm<<endl;
  48. }
  49. return 0;
  50. }
  51.  
Success #stdin #stdout 0s 3476KB
stdin
6
00:00
23:30
14:59
23:58
00:09
11:56
stdout
00:01
23:32
15:51
00:00
00:11
12:21