fork download
  1. #include <iostream>
  2. #define _USE_MATH_DEFINES
  3. #include <math.h>
  4.  
  5. bool IsEqual(double A, double B, double G){
  6. return ((A + G >= B)&&( A - G <= B)) ? true : false;
  7. }
  8.  
  9. int main(){
  10. double SM = 360.0 / 60;
  11. double LM = 360.0 / 12;
  12. double Gosa = 1;
  13. bool F = false;
  14. double LT = 0;
  15. double MT = 0;
  16. for (int H = 0; H < 12; H++){
  17. F = false;
  18. for (int M = 0; M < 60; M++){
  19. for (int S = 0; S < 60; S++){
  20. LT = LM*H + (SM / 60.0)*M + ((SM / 360.0)*(S*6.0)) / 60.0;
  21. MT = SM*M + (SM / 60.0)*S;
  22. if (IsEqual(LT, MT,Gosa/2) == true){
  23. std::cout << floor(12*LT/360.0) << ':' << floor(60*MT/360.0) <<':'<<S<< std::endl;
  24. F = true;
  25. }
  26. if (F == true) break;
  27. }
  28. if (F == true) break;
  29. }
  30.  
  31. }
  32. return 0;
  33. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0:0:0
1:5:1
2:10:6
3:15:11
4:20:16
5:25:21
6:30:26
7:35:31
8:40:36
9:45:41
10:50:46
11:55:51