Submit | All submissions | Best solutions | Back to list |
LG - LCM Game |
Asad is a student of class 6. He loves to learn new logic from Number Theory. He receives a gift from his Mom named “LCM game”. In the game, He is given some integer and he need to find the LCM of the given integers. But he is facing some problem to find the LCM of more than two integers.
In this case, He ask for your help to find the LCM of given N integers. As you are a great programmer in our country.
Input
Every line of input contains a single integer N denoting the number of integers (until EOF) that is given to him.
Next line contain N spaces separated integer x1,x2,x3,………,xn.
Constraints:
1<=N<= 105
1<=xi<=109
Output
For each input, print a single line and the value of the LCM of N integers.
Example
Input:2
1 2
3
2 3 4
Output:2
12
2
1 2
3
2 3 4
Note: In second test case, LCM(2,3) = 6 and LCM(6,4) = 12
Added by: | asad_IT |
Date: | 2018-07-11 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Math |
hide comments
2021-03-04 01:41:39 AJ
asad_IT - wrong input a single integer N is greater than the number of integers (until EOF) that is given to him. Correct please. (N > len(x1,x2,x3,………,xn)) Last edit: 2021-03-06 23:14:16 |
|
2020-10-28 15:09:58
is there any way to solve the time limit problem in the codes? if there is ... please reply by one. |
|
2020-05-14 02:47:55
After a bunch of trying , it's still"runtime error". |