Runners
Time limit1sMemory limit512 MB
Given up to six runners on nested circular lanes of lengths 400 to 430 m, find the time interval at which all are aligned on one radius, or report that alignment never or always holds.
- Level
Medium7 of 10
- Topics
- Math, Number theory, Simulation
- Solved
- No attempts yet
Problem
Several runners are running on a track that consists of 6 circular lanes. The innermost lane is 400m long; after running 400m, a runner is back at their starting position. Each outer lane grows by 6m; the 2nd innermost lane is 406m long, and the outermost lane is 430m long. All runners start next to each other and run in the same direction around the track. Each runner runs at a constant speed for the entire race.

Determine how often all of the runners are next to each other. For this problem, imagine that each runner is a single point. Runners are considered to be "next to each other" if a line segment can be drawn from the center of the track to the outside of the track going through all of the runners.
Input
The first line of input contains the number of test cases, T, (1 ≤ T ≤ 50).
The first line of each test case contains the number of runners, R, (2 ≤ R ≤ 6).
The next R lines each contain a runner's speed, starting with the runner in the innermost lane and moving outward. The speeds are in meters per second and are all within the range 1 ≤ S ≤ 11. Each speed may contain a decimal point and up to 2 digits after the decimal point.
Output
For each test case, print a single line containing the frequency in seconds at which all runners are exactly next to each other, rounded to the nearest integer. If the runners are never all next to each other (other than at the start of the race) or are always all next to each other, print "Unable to solve" instead.