fork download
  1. #include <iostream>
  2. #include <vector>
  3. //#include <stdexcept>
  4. typedef std::pair<int, int> SepT;
  5.  
  6. SepT SeparateDigit(int N){
  7. //if (N > 60) throw std::out_of_range("value is out of range");//choice best exception by you
  8. int A = N - (N / 10) * 10;
  9. int B = (N - A)/10;
  10. std::swap(A , B);
  11. return std::make_pair(A, B);
  12. }
  13.  
  14. bool IsZorome(SepT S, bool IsZeroValid = false){
  15.  
  16. if (S.first == S.second) return true;
  17. if (S.first == 0 && IsZeroValid == true) return true;
  18.  
  19. return false;
  20. }
  21.  
  22. int main(){
  23. SepT A;
  24. SepT B;
  25. bool F1 = false;
  26. bool F2 = false;
  27.  
  28. for (int i = 0; i < 24; i++){
  29. for (int j = 0; j < 60; j++){
  30. A = SeparateDigit(i);
  31. B = SeparateDigit(j);
  32. F1 = IsZorome(A, true);
  33. F2 = IsZorome(B);
  34. if (((F1&&F2) == true)&& (A.second == B.second)) std::cout << (A.first ? A.first : 0) << A.second << ':' << B.first << B.second<<std::endl;
  35. }
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
00:00
01:11
02:22
03:33
04:44
05:55
11:11
22:22