#K46637. Orchestra Synchronization Time
Orchestra Synchronization Time
Orchestra Synchronization Time
In an orchestra, each instrument plays in a cycle. The i-th instrument completes one full cycle in \(d_i\) seconds. Given \(N\) instruments and their respective cycle times, your task is to determine the smallest positive integer \(T\) such that every instrument finishes an integer number of cycles at time \(T\) seconds. In other words, find \(T = \mathrm{LCM}(d_1,d_2,\ldots,d_N)\) (the least common multiple of the cycle times).
Input: The first line contains a single integer \(N\). The next line contains \(N\) space-separated positive integers \(d_1,d_2,\ldots,d_N\).
Output: Output a single integer, the time in seconds after which all instruments will play simultaneously again.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (N) denoting the number of instruments. The second line contains (N) space-separated integers representing the cycle times (in seconds) for each instrument.
outputFormat
Output a single integer to standard output (stdout) representing the smallest time in seconds after which all instruments synchronize.## sample
3
2 4 5
20