CCO '97 P4 - High Tide

View as PDF

Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 64M

Problem types
Canadian Computing Competition: 1997 Stage 2, Day 2, Problem 1

A planet has N moons revolving about it in constant clockwise coplanar circular orbits. How often do all the moons appear directly overhead as viewed from some point on the planet? We will call such a situation a "vertical alignment."

Input Specification

Your input consists of T sets of data, where T (1 \le T \le 100) is the first integer in the input: each set consists of an integer N (2 \le N \le 5), indicating the number of moons, followed by N distinct positive integers, one per line, indicating the exact period of revolution, R_i (1 \le R_i \le 50), for each moon, in days.

Output Specification

For each of the T sets of data, generate a line of output indicating the interval in days between consecutive vertical alignments up to an absolute error of 10^{-2}.

Sample Input

3
2
20
30
3
20
30
40
2
10
3

Sample Output

60.00
120.00
4.29

Comments

There are no comments at the moment.