fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int gio,phut,giay;
  6.  
  7. void init(){
  8. cin>>gio;
  9. cin>>phut;
  10. cin>>giay;
  11.  
  12.  
  13.  
  14.  
  15. }
  16. void solve(){
  17. if((gio<=24&&gio>=0)||(phut<=59&&phut>=0)&&(giay<=59&&giay>=0)){
  18. cout<<"YES"<<endl;
  19. giay++;
  20. if(giay==60){
  21. giay=0;
  22. phut++;
  23. }
  24. if(phut==60){
  25. phut=0;
  26. gio++;
  27. }
  28. if(gio==24){
  29. gio=0;
  30. }
  31.  
  32.  
  33. cout<<gio<<":"<<phut<<":"<<giay;
  34. }
  35. else cout<<"NO"<<endl;
  36.  
  37. }
  38.  
  39. int main(){
  40. init();
  41. solve();
  42. return 0;
  43.  
  44.  
  45. }
  46.  
Success #stdin #stdout 0.01s 5324KB
stdin
2
59
59
stdout
YES
3:0:0