Problem:


Score : 300 points

Problem Statement

We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.

Initially, the hand of every clock stands still, pointing directly upward.

Now, Dolphin starts all the clocks simultaneously.

In how many seconds will the hand of every clock point directly upward again?

Constraints

1≤N≤100 

1≤T_i≤10^{18} 

All input values are integers.  

The correct answer is at most 10^{18} seconds.

Input

Input is given from Standard Input in the following format:  

N
T_1
:  
T_N

Output

Print the number of seconds after which the hand of every clock point directly upward again.

Sample Input 1

2
2
3

Sample Output 1

6

We have two clocks. The time when the hand of each clock points upward is as follows:

Clock 1: 2, 4, 6, ... seconds after the beginning

Clock 2: 3, 6, 9, ... seconds after the beginning

Therefore, it takes 6 seconds until the hands of both clocks point directly upward.

Sample Input 2

5
2
5
10
1000000000000000000
1000000000000000000

Sample Output 2

1000000000000000000



Sample input:
2
2
3


Sample output:
6

Submission status: Time Limit Exceeded

Solution code:
deploy = True
if not deploy:
    with open('input.txt', 'r') as f:
        fid = list(map(lambda x: int(x.rstrip()), f.readlines()))
    Ti = fid[1:]
    n = int(fid[0])
else:
    n = int(input())

    Ti = []
    for t in range(n):
        Ti.append(int(input()))

Max = max(Ti)

while True:
    m = [Max for i in range(n)]
    d = [x % y for x, y in zip(m, Ti)]

    if d == [0 for i in range(n)]:
        break

    Max += max(Ti)

print(Max)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    N = int(input())
    T = []
    for i in range(N):
        T.append(int(input()))
    maxT = max(T)
    i = maxT
    for i in range(maxT, 10**18+1, maxT):
        k = 0
        for j in range(N):
            if (i%T[j]) == 0:
                k += 1
            else:
                break
        if k == N:
            print(i)
            break

Submission status: Time Limit Exceeded

Solution code:
import sys

if __name__ == '__main__':
    N = int(input())
    T = []
    for i in range(N):
        T.append(int(input()))
    maxT = max(T)
    for i in range(maxT,10**18+1, maxT):
        k = 0
        for j in range(N):
            if (i%T[j]) == 0:
                k += 1
            else:
                break
        if k == N:
            print(i)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
import sys

if __name__ == '__main__':
    N = int(input())
    T = []
    for i in range(N):
        T.append(int(input()))
    maxT = max(T)
    for i in range(maxT,10**18+1, maxT):
        k = 0
        for j in range(N):
            if (i%T[j]) == 0:
                k += 1
        if k == N:
            print(i)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
import sys

N = int(raw_input())
array = []
for i in range(N):
    array.append(int(raw_input()))

array.sort()

def euclid(a, b):
    while a != b:
        if a > b:
            if a % b == 0:
                return b
            a = a-b
        else:
            if b % a == 0:
                return a
            b = b-a
    return a

result = array[0]
for i in array[1:]:
    result = result * i / euclid(result, i)
print result

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))
for x in range(1,10**8):
    z = 0
    for y in T:
        z += x % y
    if z == 0:
        print(x)
        break

Submission status: Time Limit Exceeded

Solution code:

def lcmm(l,m):
    low,high = 1,1
    
    if(l==m):return l
    elif(l>m):
        if(l % m ==0):return l
        high = l
        low = m
        
    else:
        if(m % l ==0):return m
        high = m
        low = l
    lcm = high
    while(lcm%low != 0):
        lcm += high

    return lcm
n = int(input().strip())
last = 1
lcm = 1
for i in range(n):
    num = int(input().strip())
    lcm = lcmm(lcm,num)
    #print(lcm)

print(lcm)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
ans = T[0]
for i in T:
  k = 1
  if ans // i < 1:
    k = i // ans
  for j in range(k, i+1):
    if ans * j % i == 0:
      ans = ans * j
      break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
T.sort()
ans = T[0]
for i in T:
  k = 1
  if ans // i < 1:
    k = i // ans
  for j in range(k, i+1):
    if ans * j % i == 0:
      ans = ans * j
      break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = [int(input()) for x in range(N)]

ans = max(a)
mx = max(a)
iteration = 1 
while (ans <= 1000000000000000000):
    flag = True 
    for item in a:
        if not (ans%item == 0):
           flag = False
    if flag:
        print(ans)
        break
    else:
        iteration = iteration + 1
        ans = iteration * mx

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = [0]*N

for i in range(N):
	T[i] = int(input())



def A(j, A):

	for k in range(N):

		if(j % A[k] > 0):
			break

		elif(k == N - 1):
			return 1

	return 0


j = 1

while(True):

	if(A(j, T) == 1):
		print(j)
		break

	j += 1

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_set = set()
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t
 
	t_set.add(t)
 
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_set:
		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False
 
print(max*times)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t
 
	t_list.append(t)

t_list = list(set(t_list))
t_list = sorted(t_list)[::-1]
t_list.pop(0)
 
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False
 
print(max*times)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t

	t_list.append(t)

t_list = list(set(t_list))
t_list = sorted(t_list)[::-1]
t_list.pop(0)
 
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if t == max:
			continue

		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False
 
print(max*times)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t

	t_list.append(t)
 
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if t == max:
			continue

		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False
 
print(max*times)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
for i in range(n):
	t_list.append(int(input()))

t_list = sorted(t_list)[::-1]
t_min = t_list[0]
for i in range(len(t_list)-1):
	if t_min%t_list[1+i] != 0:
		j = 2
		while True:
			if t_list[1+i]*j % t_min == 0:
				t_min = t_list[1+i]*j
				break

			j += 1

print(t_min)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
for i in range(n):
	t_list.append(int(input()))

t_max = max(t_list)
times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if (t_max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False

print(t_max*times)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t_list = []
max = 0
for i in range(n):
	t = int(input())
	if t > max:
		max = t

	t_list.append(t)

times = 0
is_not_divisible = True
while is_not_divisible:
	times += 1
	for t in t_list:
		if (max*times)%t != 0:
			is_not_divisible = True
			break
		else:
			is_not_divisible = False

print(max*times)

Submission status: Time Limit Exceeded

Solution code:
def lcm(a, b):
    ax = a
    bx = b
    c = 0
    if a<b:
        ax, bx = (bx, ax)
    while True:
        if ax%bx == 0:
            gcd = bx
            break
        else:
            c = bx
            bx = ax%bx
            ax = c
    return a*b // gcd

n = int(input())
Mx = int(input())
lst = [Mx]
lst2 = []
for i in range(n-1):
    a = int(input())
    if Mx%a != 0:
        lst.append(a)
        lst.sort()
        if Mx<a:
            Mx = a

while True:
    y = len(lst)
    for i in range(y-1):
        lst2.append(lcm(lst[i], lst[i+1]))
    x = len(lst2)
    if x==1:
        print(lst2[0])
        break
    lst.clear()
    for i in range(x-1):
        lst.append(lcm(lst2[i], lst2[i+1]))
    y = len(lst)
    if y==1:
        print(lst[0])
        break
    lst2.clear()

Submission status: Time Limit Exceeded

Solution code:
def lcm(x, y):
   """This function takes two
   integers and returns the L.C.M."""

   # choose the greater number
   if x > y:
       greater = x
   else:
       greater = y

   while(True):
       if((greater % x == 0) and (greater % y == 0)):
           lcm = greater
           break
       greater += 1

   return lcm

# change the values of num1 and num2 for a different result



n = int(input())
arr = []
for _ in range(n):
	arr.append(int(input()))
	
lc = arr[0]
for i in range(n):
	lc = lcm(lc, arr[i])
	
print(lc)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = []
for _ in range(N):
    T.append(int(input()))

def gcd(a, b):
    if(b > a):
        a, b = b, a

    while(a != b):
        temp = b
        b = a - b
        a = temp
    return a

if max(T) > 5*10**17:
    print(max(T))
else:
    tmp = T[0]
    for i in range(1, N):
        tmp = tmp/gcd(tmp, T[i])*T[i]

    print(int(tmp))

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce    # need this line if you're using Python3.x

def lcm(a, b):
    if a > b:
        greater = a
    else:
        greater = b

    while True:
        if greater % a == 0 and greater % b == 0:
            lcm = greater
            break
        greater += 1

    return lcm

def get_lcm_for(your_list):
    return reduce(lambda x, y: lcm(x, y), your_list)

arr = []
n = int(input())
for _ in  range(n):
	arr.append(int(input()))

ans = get_lcm_for(arr)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
T = sorted(T, reverse=True)
for i in range(1, 10**18//T[0] + 1):
    f = True
    for n in T[1:]:
        if i*T[0] % n != 0:
            f = False
            break
    if f:
        print(i*T[0])
        sys.exit()

Submission status: Time Limit Exceeded

Solution code:
def lcm(a,b):
	if(a>b):
	    min1=a
	else:
	    min1=b
	while(1):
	    if(min1%a==0 and min1%b==0):
	        return min1
	    min1=min1+1
l = []
for x in range(int(raw_input())):
	l.append(int(raw_input()))
ans = 1
for x in l:
	ans = lcm(ans,x)
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
from functools import reduce

def lcm(x, y):
  return (x*y) // gcd(x, y)

N = int(input())
TS = [int(input()) for _ in range(N)]

print(reduce(lcm, TS))

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
T = []
for i in range(n):
    T.append(int(input()))

tmp = T[0]
for i in range(1,n):
    g = gcd(tmp,T[i])
    tmp = T[i]*tmp//g
    
print(tmp)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
N_List = []
for i in range(N):
    N_List.append(int(input()))

print(lcm_list(N_List))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
lis = []
for i in range(n):
    lis.append(int(input()))
print(np.lcm.reduce(lis))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 26 22:43:32 2020

@author: liang
"""

from math import gcd

N = int(input())
T = [int(input()) for i in range(N)]
ans = 1

for i in range(N):
    ans = ans*T[i]//gcd(ans,T[i])

print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(list):
    return reduce(lcm_base, list, 1)

N = int(input())
T = [int(input()) for i in range(N)]

print(lcm_list(T))

Submission status: Accepted

Solution code:
import math
        
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
ans = T[0]

for i in range(1, N):
    ans = ans * T[i] // math.gcd(ans, T[i])

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
T = [int(input()) for _ in range(n)]

def gcd(a, b):
  if a > b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return b

def lcm(a, b):
  return a * b // gcd(a, b)

l = T.pop()
for t in T:
  l = lcm(l, t)
print(l)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
AA = [int(input()) for i in range(N)]
print(lcm(*AA))

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 1
for i in range(N):
  a = int(input())
  ans = ans*a//math.gcd(ans,a)
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
T = [int(input()) for _ in range(n)]

#最小公倍数
def lcm(x, y):
    return (x*y)//math.gcd(x, y)

ans = T[0]
for t in T[1:]:
    ans = lcm(ans, t)
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
from math import gcd
g = 0
ans = 1
for _ in range(N):
    t = int(input())
    g = gcd(t, ans)
    ans = t*ans//g
print(ans)

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N=int(input())
T = [int(input()) for _ in range(N)]
a = T[0]
for i in range(1,N):
    b = T[i]
    c = gcd(a,b)
    a = (a//c)*b
print(a)

Submission status: Accepted

Solution code:
import math

n = int(input())
t = [int(input()) for _ in range(n)]

ans = 1
for i in t:
    ans = ans*i // math.gcd(ans, i)
print(ans)

Submission status: Accepted

Solution code:
import math
def lcm(x,y):
    return (x*y)//(math.gcd(x,y))

n=int(input())
t=[int(input()) for _ in range(n)]
ans=1
for i in t:
    ans=lcm(i,ans)
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = 1
for _ in range(n):
    t1 = int(input())
    ans = ans//math.gcd(ans, t1)*t1

print(ans)

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
ans = int(input())
for _ in range(n - 1):
    t = int(input())
    ans = (ans * t) // gcd(ans, t)

print(ans)

Submission status: Accepted

Solution code:
from math import gcd
def lcm(x,y):
    return (x*y)//gcd(x,y)
N=int(input())
ans=1
for i in range(N):
    ans=lcm(ans,int(input()))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T = []

for i in range(N):
  T.append(int(input()))

import math

def lcm(m,n):
  return (m*n)//math.gcd(m,n)

def lcm_list(nums):
  lcm_num = nums[0]
  for i in range(1,len(nums)):
    lcm_num = lcm(lcm_num,nums[i])
  return lcm_num

print(lcm_list(T))

Submission status: Accepted

Solution code:
n = int(input())
from fractions import gcd
g = int(input())
for i in range(n-1):
  h = int(input())
  g = g * h // gcd(g,h)
print(g)

Submission status: Accepted

Solution code:
import math

a = 1
n = int(input())
for i in range(n):
  t = int(input())
  a = (a * t) // math.gcd(a, t)
print(a)

Submission status: Accepted

Solution code:
import math

n = int(input())
tl = list(int(input()) for _ in range(n))

if n == 1:
    print(tl[0])
else:
    ans = tl[0]
    for i in range(1, n):
        ans = ans//math.gcd(ans, tl[i])*tl[i]

    print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
T = int(input())
for i in range(N-1):
    t = int(input())
    T = T // math.gcd(T, t) * t
print(T)

Submission status: Accepted

Solution code:
import sys
import math
pin=sys.stdin.readline

def main():
  N=int(pin())
  ans=int(pin())
  for i in range(N-1):
    T=int(pin())
    ans=(ans*T)//math.gcd(ans,T)
  print(ans)
  return
main()

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
a = 1
for _ in range(n):
  x = int(input())
  a = a // gcd(a, x) * x
print(a)

Submission status: Accepted

Solution code:
import fractions
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)
n=int(input())
t=[0]*n
num=1
for i in range(n):
    t[i]=int(input())
    num=lcm(num,t[i])
print(num)

Submission status: Accepted

Solution code:
from math import gcd
N = int(input())
def lcm(a,b):
    return a*b//gcd(a,b)

T1 = int(input())
ans = T1
for i in range(N-1):
    T2 = int(input())
    ans = lcm(ans,T2)
    T1 = T2

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(a, b):
    return a*b // math.gcd(a, b)

ans = T[0]
for i in range(1, N):
    ans = lcm(ans, T[i])
print(ans)

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)
      
N=int(input())
T=[]
total=1
for i in range(N):
    a=int(input())
    T.append(a)
T_set=sorted(list(set(T)))
M=len(T_set)

ans=T_set[0]
if M==1:
    ans=T_set[0]
else:
    for i in range(1,M):
        ans=lcm(ans,T_set[i])

print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
  if (b == 0): 
    return a
  return gcd(b, a % b)

arr = [int(input()) for i in range(int(input()))]
ans = 1
for i in arr:
  ans = (ans*i)//gcd(ans, i)
print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce


n = int(input())
tt = [int(input()) for i in range(n)]

x = 1

def lcm_base(x,y):
  return (x*y) // math.gcd(x,y)
def lcm(*numbers):
  return reduce(lcm_base, numbers, 1)

print(lcm(*tt))

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b!=0:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a*b // gcd(a,b)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)

Submission status: Accepted

Solution code:
def main():
    def gcd(a,b):
        while b!=0:
            a, b = b, a%b
        return a

    def lcm(a,b):
        return a*b // gcd(a,b)

    N = int(input())
    T = [int(input()) for _ in range(N)]
    ans = 1
    for t in T:
        ans = lcm(ans, t)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def gcd(a,b):
    while b!=0:
        tmp = b
        b = a%b
        a = tmp
    return a

def lcm(a,b):
    return a*b // gcd(a,b)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)

Submission status: Accepted

Solution code:
import math

def lcm(x, y):
    return x * y // math.gcd(x, y)

n = int(input())
t = int(input())

for i in range(n - 1):
    num = int(input())
    t = lcm(t, num)
print(t)

Submission status: Accepted

Solution code:
import math


def lcm(x, y):
    return x * y // math.gcd(x, y)


def main():
    n = int(input())
    t_lst = [int(input()) for _ in range(n)]
    t_lst.sort()
    answer = t_lst[0]
    for i in range(1, n):
        t = t_lst[i]
        answer = lcm(answer, t)

    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
n=int(input())
t=[int(input()) for i in range(n)]
res=t[0]
for i in range(1,n):
  res=res*t[i]//math.gcd(res,t[i])
print(res)

Submission status: Accepted

Solution code:
import math
from functools import reduce


def gcd(*numbers):  # greatest common divisor
    return reduce(math.gcd, numbers)


def lcm_base(x, y):  # least common multiplier
    return (x*y) // math.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    n = int(input())
    t = []
    for i in range(n):
        t.append(int(input()))

    answer = lcm(*t)

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
T = [int(input()) for i in range(N)]
print(lcm_list(T))

Submission status: Accepted

Solution code:
N = int(input())
ti = [int(input()) for i in range(N)]


def euc_alg(val1, val2):

    if val1 == val2:
        return val1

    mod = min(val1, val2)
    divided = max(val1, val2)
    while 1:
        tmp_mod = divided % mod

        if tmp_mod == 0:
            break
        divided = mod
        mod = tmp_mod

    ret = val1 * val2 // mod

    return ret

maxti = max(ti)
# least_common_mult = max([euc_alg(maxti, t) for t in ti])

ans = ti[0]
for t in ti:
    ans = euc_alg(ans, t)

print(ans)

Submission status: Accepted

Solution code:
import math

def lcm(a,b):
    return a*b//math.gcd(a,b)

n = int(input())

ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))

print(ans)

Submission status: Accepted

Solution code:
import fractions
N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0]
for i in range (1, N):
  ans = ans * A[i] // fractions.gcd(ans, A[i])
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
with open(0) as f:
    N, *T = map(int, f.read().split())
ans = 1
for t in T:
    ans = np.lcm(ans, t)
print(ans)

Submission status: Accepted

Solution code:
import math

def lcm(a,b):
    return a*b//math.gcd(a,b)

N=int(input())
T=[int(input()) for _ in range(N)]
ans=1
for t in T:
    ans=lcm(ans,t)
print(ans)

Submission status: Accepted

Solution code:
import math

def main():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    lcm = 1
    for t in T:
        lcm = lcm * t // math.gcd(lcm, t)
    print(lcm)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# C - Multiple Clocks
import functools
import math
N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(a,b):
    LCM = a*b//math.gcd(a,b)
    return LCM

def all_lcm(A):
    ans = functools.reduce(lcm,A,1)
    return ans

print(all_lcm(T))

Submission status: Accepted

Solution code:
from math import gcd
N = int(input())
ans = 1
for i in range(N):
  n = int(input())
  ans = ans * n // gcd(ans, n)
print(ans)

Submission status: Accepted

Solution code:
def gcd(x, y):
    if(y == 0):
        return x
        
    return gcd(y, x%y)
    
def lcm(x, y):
    return (x*y)//(gcd(x, y))


n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
        
l = x[0]
for i in range(1, n):
    l = lcm(l, x[i])
        
print(l)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
t=[int(input()) for _ in range(n)]

print(lcm(*t))

Submission status: Accepted

Solution code:
import math
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))

Submission status: Accepted

Solution code:
N=int(input())
T=list(int(input()) for _ in range(N))

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

l=T[0]
for t in T:
	l=l // gcd(l, t) * t
print(l)

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N = int(input())
T = [int(input()) for _ in range(N)]
print(llcm(T))

Submission status: Accepted

Solution code:
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    return a // g * b

N = int(input())
T = [int(input()) for _ in range(N)]

ans = 1

for i in range(N):
    ans = lcm(ans, T[i])

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T=list(int(input()) for _ in range(N))

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

ans=T[0]
for i in range(1, N):
	ans=ans*T[i]//gcd(ans, T[i])
print(ans)

Submission status: Accepted

Solution code:
from math import gcd as g
n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
def l(a,b):
    return(a*b//g(a,b))
ans=t[0]
for i in range(n):
    ans=l(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

ans=t[0]
for i in range(1,n):
    ans=lcm(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
from math import gcd
def lcm(a,b):
  return a*b//gcd(a,b)
N=int(input())
T=[0]*N
for i in range(N):
  T[i]=int(input())
ans=1
for i in range(N):
  ans=lcm(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for _ in range(n)]

print(lcm(*t))

Submission status: Accepted

Solution code:

import math
from functools import reduce

url = "https://atcoder.jp//contests/abc070/tasks/abc070_c"

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    count = int(input())
    clocks = []
    for i in range(count):
        clocks.append(int(input()))
    print(lcm(*clocks))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#最大公約数
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

#最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)

#全ての最小公倍数を求めればいい
n=int(input())
ans=1
for i in range(n):
  ans=lcm(ans,int(input()))
print(ans)

Submission status: Accepted

Solution code:
#
# abc070 c
#
import sys
from io import StringIO
import unittest
import math
from functools import reduce


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
2
3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
2
5
10
1000000000000000000
1000000000000000000"""
        output = """1000000000000000000"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    T = [int(input()) for _ in range(N)]

    print(lcmlist(T))


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def lcmlist(l):
    return reduce(lcm, l)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    from functools import reduce
    def lcm_base(n1,n2):
        return (n1*n2)//math.gcd(n1,n2)
    def lcm(*numbers):
        return reduce(lcm_base, numbers)

    n = I()
    t = [0 for _ in range(n)]
    for i in range(n):
        t[i] = I()

    ans = lcm(*t)
    print(ans)
main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-04 15:32:03 +0900
# LastModified: 2020-09-04 15:43:28 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def gcd(a, b):
    while a % b != 0:
        r = a % b
        a = b
        b = r
    return b


def main():
    n = int(input())
    ans = int(input())
    for _ in range(n-1):
        t = int(input())
        ans = ans*t//gcd(max(ans, t), min(ans, t))
    print(ans)




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import *

def lcm(x,y):
  return (x*y)//gcd(x,y)

N=int(input())
T=[int(input()) for _ in range(N)]
ans=T[0]
for i in range(1,N):
  ans=lcm(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
from math import *

N=int(input())
T=list(int(input()) for _ in range(N))
ans=T[0]
for i in range(1,N):
  ans=ans*T[i]//gcd(ans,T[i])
print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)

def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)

n=int(input())
nums=[int(input()) for i in range(n)]

print(lcm_list(nums))

Submission status: Accepted

Solution code:
import math
import functools
def lcm(x,y):
    return (x*y)//math.gcd(x,y)
n = int(input())
t = [int(input()) for i in range(n)]
a = functools.reduce(math.gcd,t)
print(functools.reduce(lcm,t))

Submission status: Accepted

Solution code:
N = int(input())
T = [int(input()) for i in range(N)]
import math
a = T[0]
for i in range(1,N):
    a = (a*T[i]) // math.gcd(a,T[i])
print(a)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    t = i_input()
    for i in range(n-1):
        k = i_input()
        t = t*k//gcd(t,k)
    print(t)



if __name__=="__main__":
    main()