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

0)

 `{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.
1)

 `{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.
2)

 `{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.
3)

 `{1, 2, 4, 8, 16, 32, 64, 128}`
`Returns: 0.0`

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=4446

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=9900&pm=4446

dgoodman

Testers:

PabloGilberto , lbackstrom , brett1479 , Olexiy

Math