Statistics

Problem Statement for "Synchro"

Problem Statement

Synchronize your watches to 12:00 ....... now!

We have a collection of watches whose hands move continuously. Create a class Synchro that contains a method resynch that is given a int[] watch telling how many minutes the hand of each watch advances in an hour and that returns the position of the minute hands (in minutes past the hour) at the first time when the minute hands all exactly agree again.

Each element of watch describes a different watch. The returned value should be a non-negative double less than 60. Ignore (or rip off!) the hour hands.

Definition

Class:
Synchro
Method:
resynch
Parameters:
int[]
Returns:
double
Method signature:
double resynch(int[] watch)
(be sure your method is public)

Notes

  • The returned value must be accurate to within a relative or absolute value of 1E-9.

Constraints

  • watch will contain between 2 and 10 elements, inclusive.
  • Each element of watch will be between 1 and 200, inclusive.

Examples

  1. {59,59,59}

    Returns: 0.0

    These watches are a little slow but they stay synchronized. So the first time that the minute hands are resynchronized is arbitrarily close to 0.

  2. {60,53}

    Returns: 34.28571428571427

    After 8 hours the first watch has its minute hand at 0 and the other watch has circled 7 times and has its minute hand at 4 minutes. The faster watch then catches up in 4/7 of an additional hour, and at that point both minute hands are at 34.285.

  3. {120,40}

    Returns: 30.0

    The faster watch catches the slower one in 3/4 of an hour at which point they are both at the half hour position.

  4. {200,199,198,197,196,195,194,193,192,191}

    Returns: 0.0

  5. {199,200}

    Returns: 0.0

  6. {198,77}

    Returns: 38.18181818181819

  7. {73,49}

    Returns: 2.499999999999991

  8. {81,83,41,21}

    Returns: 30.0

  9. {50,74,26,50}

    Returns: 5.000000000000009

  10. {50,74,26,50,98}

    Returns: 5.000000000000009

  11. {37,13,25}

    Returns: 5.000000000000009

  12. {61,123}

    Returns: 59.03225806451613

  13. {7,4,97,151}

    Returns: 20.000000000000007

  14. {73,95,197,97,97,73,95,197,73}

    Returns: 30.0

  15. {2, 3, 5, 7, 11, 13, 17, 19}

    Returns: 0.0

  16. {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}

    Returns: 0.0

  17. {1, 2, 4, 8, 16, 32, 64, 128}

    Returns: 0.0

  18. {1, 2, 4, 8, 16, 32, 64, 128, 3, 6}

    Returns: 0.0

  19. {78, 55, 66}

    Returns: 0.0

  20. {2, 69, 115}

    Returns: 0.0

  21. {179, 165, 131, 68, 128, 10, 183}

    Returns: 0.0

  22. {140, 25, 196, 100, 44, 114, 102}

    Returns: 0.0

  23. {17, 38}

    Returns: 48.57142857142857

  24. {82, 187}

    Returns: 46.857142857142854

  25. {91, 163, 126, 171, 142}

    Returns: 0.0

  26. {187, 181, 74, 152, 46}

    Returns: 0.0

  27. {22, 170, 62, 107, 85, 12, 137}

    Returns: 0.0

  28. {158, 88, 100, 176, 179, 56, 93}

    Returns: 0.0

  29. {19, 171, 166, 95, 125, 79, 93}

    Returns: 0.0

  30. {104, 176, 126, 124, 48, 135, 51}

    Returns: 0.0

  31. {141, 82, 77, 117, 98, 114, 1, 126, 63, 68}

    Returns: 0.0

  32. {92, 69, 193, 179, 57, 64, 70, 15, 112, 110}

    Returns: 0.0

  33. {114, 8, 25, 114}

    Returns: 0.0

  34. {71, 79, 188, 170, 23, 147, 75, 196, 64, 80}

    Returns: 0.0

  35. {61, 126, 173, 113, 17, 83, 54, 112, 76, 184}

    Returns: 0.0

  36. {78, 147}

    Returns: 7.826086956521734

  37. {40, 55}

    Returns: 39.99999999999999

  38. {187, 135, 157, 56, 76, 179, 174, 83, 86}

    Returns: 0.0

  39. {184, 46, 86, 34, 172, 27, 119, 84, 67}

    Returns: 0.0

  40. {198, 104, 147, 25}

    Returns: 0.0

  41. {45, 194, 57, 80}

    Returns: 0.0

  42. {154, 14}

    Returns: 6.000000000000005

  43. {96, 103}

    Returns: 42.85714285714292

  44. {149, 79, 113, 37, 86, 185, 164, 42, 176, 82}

    Returns: 0.0

  45. {66, 44, 130, 140, 93, 57, 163, 43, 111, 60}

    Returns: 0.0

  46. {77, 195, 159}

    Returns: 30.0

  47. {136, 150, 56}

    Returns: 0.0

  48. {46, 106}

    Returns: 46.0


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: