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: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Tue Feb 25 07:58:24 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m % n)

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

n = ni()
T = nin(n)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions 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:
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())
t0=int(input())
if n==1:
    print(t0)
else:
    t1=int(input())
    t_lcm=lcm(t0,t1)
    for i in range(n-2):
        t2=int(input())
        t_lcm=lcm(t_lcm,t2)
    print(t_lcm)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


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


def main():
    clocks_num = int(input())
    time = [int(input()) for _ in range(clocks_num)]
    print(reduce(lcm, time))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def gcd(n,m):
    if n < m:
        t = n
        n = m
        m = t
    r = n % m
    while r > 0:
        n, m = m, r
        r = n % m
    return m
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    g = gcd(ans,T[i])
    ans = ans*T[i]//g
print(ans)

Submission status: Accepted

Solution code:
def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


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


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

Submission status: Accepted

Solution code:
from fractions import gcd

n = int(input())
t = [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 fractions
N = int(input())
T = [int(input()) for _ in range(N)]


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


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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
lis = [int(input()) for _ in range(n)]
x = lis[0]
for i in lis[1:]:
    x = x*i // gcd(x,i)
print(x)

Submission status: Accepted

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


#a>b
def gcd(a, b):
    if b:
        return gcd(b, a%b)
    else:
        return a

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

ans = 1
for i in range(n):
    ans = lcm(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 b == 0:
        return a
    return gcd(b, a%b)

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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


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


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


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


print(lcm(*T))

Submission status: Accepted

Solution code:
import fractions

n=int(input())
t=[int(input()) for _ in range(n)]
ans = t[0]
for i in range(1, n):
    ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)

Submission status: Accepted

Solution code:
import fractions

t = 1
n = int(input())

for i in range(n):
    s = int(input())
    t = t * s // fractions.gcd(t, s)
    
print(t)

Submission status: Accepted

Solution code:
from fractions import gcd
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] // gcd(ans, t[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


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


N = int(input())
T = int(input())
for _ in range(N - 1):
    # print(T)
    T = lcm(T, int(input()))
print(T)

Submission status: Accepted

Solution code:
import fractions

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

def saiki(n , t , maxi):

    saikimaxi = 0
    for i in range(n):
        if maxi % t[i] != 0:
            saikimaxi = max(saikimaxi , t[i])

    if saikimaxi != 0:
        return saiki(n , t , lcm(maxi , saikimaxi))
    else:
        return maxi

def multiclocks(n , t):

    maxi = max(t)
    return saiki(n , t , maxi)

def main():
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(multiclocks(n , t))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
lists=[]
for i in range(n):
  a=int(input())
  lists.append(a)
#Nこの連続した数の最大公約数、最小公倍数を求めるアルゴリズム
import math
import fractions

#最小公倍数
def union_lcm(lists):
    if len(lists)==1:
        return lists[0]
    elif len(lists)>1:
        num=lists[0]
        for i in range(1,len(lists)):
            num=num*lists[i]//fractions.gcd(num,lists[i])
        return num
P=union_lcm(lists)
print(P)

Submission status: Accepted

Solution code:
import fractions

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

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

ans = T[0]

for index, t in enumerate(T):
  if index == 0:
    continue

  ans = lcm(ans, t)

print(ans)

Submission status: Accepted

Solution code:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

#print(lcm(27, 18, 9, 3))
n=int(input())
ab = []
for _ in range(n):
    a= int(input())
    ab.append(a)
print(lcm(ab))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
t=lin(n)


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

print(lcm(t))

Submission status: Accepted

Solution code:
import fractions
n = int(input())
a = int(input())
for i in range(n-1):
  b = int(input())
  a = a*b//fractions.gcd(a,b)
print(a)

Submission status: Accepted

Solution code:
N = int(input())
lst = [1] + [int(input()) for _ in range(N)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


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


ret = lcm(lst[0], lst[1])
for x in lst[2:]:
    ret = lcm(ret, x)
print(ret)

Submission status: Accepted

Solution code:
def gcd(n,m):#n,mは正の整数、最大公約数　許容は？
    if n==0:
        return m
    elif m==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)
def lcm(n,m):
    return n*m//gcd(n,m)


def longlcm(A):
    import copy
    if len(A)==2:
        return A[0]*A[1]//gcd(A[0],A[1])
    else:
        x=A[0]
        for i in range(1,len(A)):
            x=lcm(x,A[i])
        return x

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

print(longlcm(T))

Submission status: Accepted

Solution code:

import math

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

N=int(input())

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

cal = T[0]

i = 1
now = T[0]
while(i<N):
    m = T[i] * now
    now = m // gcd(now, T[i])
    i+=1
print(now)

Submission status: Accepted

Solution code:
#import math  
import fractions
from functools import reduce

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

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
ans = lcm_list(T)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def GCD(a,b):
    if b == 0:
        return a
    else:
        return GCD(b,a%b)
def LCM(a,b):
    return (a//GCD(a,b)*b)
ans = 1
for i in range(n):
    t = int(input())
    ans = LCM(ans,t)

print(ans)

Submission status: Accepted

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

from fractions import gcd

def list_lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(list_lcm(A))

Submission status: Accepted

Solution code:
import fractions

n = int(input())
x = int(input())
ans = x

for i in range(n - 1):
  ix = int(input())
  ans = (ans * ix // fractions.gcd(ans, ix))
  
print(ans)

Submission status: Accepted

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

import fractions

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

Submission status: Accepted

Solution code:
import sys
import fractions

n=int(input())
list=[]
ans=1
for i in range(n):
	t=int(input())
	list.append(t)
	ans =ans * list[i] // fractions.gcd(ans, list[i])
print(ans)

Submission status: Accepted

Solution code:
import fractions

n = int(input())
x = int(input())
ans = x

for i in range(n - 1):
  ix = int(input())
  ans = (ans * ix // fractions.gcd(ans, ix))
  
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
t = [int(input()) for i in range(n)]

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

x = t[0]
for i in t[1:]:
	x = lcm(i,x)
print (x)

Submission status: Accepted

Solution code:
def lcm(a, b):
    x, y = a, b
    while y != 0:
        x, y = y, x % y
    return a * b // x

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 fractions

def a(A, B):
    C = fractions.gcd(A, B)
    return (A * B)//C

N = int(input())

T = []

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

T = sorted(T)
C = T[0]

if N > 1:
    for i in range(1, N):
        C = a(C, T[i])
print(C)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
 
def lcm(a,b):
    return (a*b)//gcd(a,b)
 
def lcm_list(l):
    return reduce(lcm, l)
 
 
def solve():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm_list(T))
    
solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd

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

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

a = 1
for i in range(n):
    b = t[i]
    a = lcm(a, b)

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
N = int(input())
x = int(input())
ans = x
for i in range(N-1):
    input_x = int(input())
    ans = (ans * input_x // fractions.gcd(ans, input_x))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import fractions
from functools import reduce

# N 時計の数
n = int(input())

# Ti 各時計が1周する秒数
t = [int(input()) for i in range(n)]

# 最小公倍数を求める
def lcm_base(a, b):
    return (a * b) // fractions.gcd(a, b)

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

print(lcm(*t))

Submission status: Accepted

Solution code:
import sys
import numpy as np

# N 時計の数
n = int(input())

# Ti 各時計が1周する秒数
t = []
for i in range(n):
    t.append(int(input()))
    
# 最大公約数を求める
def gcb(a, b):
    if b == 0:
        return a
    return int(gcb(b, a % b))

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

if (n == 1):
    print(t[0])
else:
    ans = 1
    for num in t:
        ans = lcm(ans, num)
    print(int(ans))

Submission status: Accepted

Solution code:
#####################
#複数の最小公倍数lcm
#####################
from fractions import gcd
def Lcm(list):
  L = 1
  for a in list:
    L = (a // gcd(a, L))*L
  return L
n= int(input())
A = [int(input()) for i in range(n)]
print(Lcm(A))

Submission status: Accepted

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

n = int(input())
ans = 1

for i in range(n):
  x = int(input())
  ans *= x//gcd(ans,x)
  
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, T: "List[int]"):
    from functools import reduce

    def lcm_base(a: int, b:int):
        return a*b // gcd(a,b)

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

    def gcd_base(a: int, b: int):
        while b:
            a, b = b, a%b

        return a

    def gcd(*numbers):
        return reduce(gcd_base, numbers)

    print(lcm(*T))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, T)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=[int(input()) for i in range(N)]
  
import fractions
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:
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))

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

result=1
for num in S:
    result = lcm(result,num)
print(result)

Submission status: Accepted

Solution code:
def solve(n, T):

    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)
    return l

_n = int(input())
_T = [int(input()) for _ in range(_n)]
print(solve(_n, _T))

Submission status: Accepted

Solution code:
import math
import calendar
import fractions
import itertools
from fractions import gcd
n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm(t))

Submission status: Accepted

Solution code:
import fractions
N = int(input())
ans = 1
for _ in range(N):
    t = int(input())
    ans = ans * t // fractions.gcd(ans,t)
print(ans)

Submission status: Accepted

Solution code:
#最大公約数、最小公倍数
#C - Multiple Clocks(最小公倍数)a*b//gcd(a,b)
#https://atcoder.jp/contests/abc070/tasks/abc070_c

from fractions import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]
for i in range(1,n):
    ans *= t[i]//gcd(ans,t[i])
print(ans)

Submission status: Accepted

Solution code:
import fractions

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

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

print(result)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
n=int(input())
t=[]
for _ in range(n):
    a=int(input())
    t.append(a)
def lcm_base(x,y):
    return (x*y // gcd(x,y))
def lcm_list(l):
    return reduce(lcm_base,l,1)
print(lcm_list(t))

Submission status: Accepted

Solution code:
# coding: utf-8
from fractions import gcd
N = int(input())
def lcm(a, b):
    return a * b // gcd(a, b)
ans = 1
for i in range(N):
    t = int(input())
    ans = lcm(ans, t)
print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# GCD -- START --
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x
# GCD --- END ---

# LCM -- START --
def lcm(x,y):
  return x*y//gcd(x,y)
# LCM --- END ---

def main():
  n=I()
  ans=I()

  for _ in range(n-1):
    ans=lcm(ans,I())

  return ans

# main()
print(main())

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 27 23:19:24 2020

@author: H_Hoshigi
"""

import fractions

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

LCM = T_list[0]

for i in T_list:
    GCD = fractions.gcd(LCM, i)
    LCM = (LCM * i)//GCD

print(LCM)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import fractions
from functools import reduce
N=int(input())
L=[]
for i in range(N):
    L.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
    
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(L))

Submission status: Accepted

Solution code:
# coding: utf-8
import fractions as math

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

N=int(input())
ans=lcm(1,int(input()))

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

print(ans)

Submission status: Accepted

Solution code:
from fractions 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:
def gcd(a, b) -> int:
  if(a < b):
    tmp = a
    a = b
    b = tmp
  if b == 0:
    return a
  return gcd(a % b, b)

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

N = int(input())
ans = int(1)
for i in range(N):
  t = int(input())
  ans = lcm(ans, t)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * t // tmp
        prev_lcm = lcm
    print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd
def lcm(a, b):
    return a * b // gcd(a, b)

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

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

Submission status: Accepted

Solution code:
from fractions import gcd

n=int(input())
lcm=1
for i in range(n):
 x=int(input())
 lcm=lcm*(x//gcd(lcm,x))
print(lcm)

Submission status: Accepted

Solution code:
from fractions import gcd

n=int(input())
lcm=1
for i in range(n):
 x=int(input())
 lcm=(lcm*x)//gcd(lcm,x)
print(lcm)

Submission status: Accepted

Solution code:
import sys
import fractions

input = sys.stdin.readline


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

    ans = 1
    for t in T:
        ans = (ans * t) // fractions.gcd(ans, t)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd

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

n = int(input())
print(reduce(lcm, [int(input()) for i in range(n)]))

Submission status: Accepted

Solution code:
def gcd(x, y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    return gcd(x % y, y)


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


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

Submission status: Accepted

Solution code:
import fractions

def gcd(A):
    ans = A[0]
    for x in range(1,len(A)):
        ans = fractions.gcd(ans,A[x])
    return ans
def lcm(A):
    ans = A[0]
    for x in range(1,len(A)):
        ans = ans * A[x] // fractions.gcd(ans,A[x])
    return ans
    

def main():
    n = int(input())
    T = []
    for x in range(n):
        T.append(int(input()))
    print(lcm(T))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def gcd(x, y):
    while True:
        r = x % y
        x, y = y, r
        if r == 0:
            return x


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


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:
import fractions
import functools

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

def lcm(a: int, b: int) -> int:
    return (a*b)//fractions.gcd(a, b)

print(functools.reduce(lcm, t))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // 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 = []
for _ in range(N):
    T.append(int(input()))

print(lcm(*T))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
N = int(input())
T = []
for _ in range(N) :
  T.append(int(input()))


def lcm(a):
  from fractions import gcd
  x = a[0]
  for i in range(1, len(a)):
      x = (x * a[i]) // gcd(x, a[i])
  return x
 
print(lcm(T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
a = int(input())
s = 1
for i in range(a):
    t= int(input())
    s = (t*s)//gcd(t,s)
print(s)

Submission status: Accepted

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

import fractions

ans = t[0]
for i in range(1, n):
   ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd


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


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


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

print(lcm(Tn))

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
lcm = lambda x,y: x*y//gcd(x,y)
N = int(input())
T = [int(input()) for _ in range(N)]
print(reduce(lcm, T))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm, numbers)

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

Submission status: Accepted

Solution code:
from functools import reduce

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


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


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(n):
        lst.append(int(input()))
    print(reduce(lcm,lst))

Submission status: Accepted

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


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


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(n):
        lst.append(int(input()))
    print(reduce(lcm,lst))

Submission status: Accepted

Solution code:
import fractions

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

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

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
n = int(input())
t = []
for _ in range(n):
  t.append(int(input()))
def lcm_base(x, y):
  return (x * y) // fractions.gcd(x, y)

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

print(lcm(t))

Submission status: Accepted

Solution code:
N = int(input())
T=[int(input()) for _ in range(N)]
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
if N>1:
    ans = lcm(T[0], T[1])
    for i in range(2,N):
        ans = lcm(ans, T[i])
else:
    ans=T[0]
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
n=int(input())
g=1
def lcm(x,y):
    return (x*y)//gcd(x,y)

for i in range(n):
    t=int(input())
    g=lcm(g,t)
print(g)

Submission status: Accepted

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

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm(A))

Submission status: Accepted

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

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

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


l = 1
for i in range(n):
    l = lcm(l, t[i])

print(l)

Submission status: Accepted

Solution code:
import fractions
n = int(input())
t = []
for _ in range(n):
    t.append(int(input()))
l = []
ans = t[0]
for i in range(1, n):
    if t[i] in l: continue
    else:
        l.append(t[i])
        ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)

Submission status: Accepted

Solution code:

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

from fractions import gcd
from functools import reduce

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

print(reduce(lcm, T))

Submission status: Accepted

Solution code:
"""import sys
input = sys.stdin.readline().strip"""
n=int(input())
T=[int(input()) for _ in range(n)]
if n==1:
    print(T[0])
    exit()
from fractions import gcd
ans=T[0]*T[1]//gcd(T[0],T[1])
for t in T:
    ans=ans*t//gcd(ans,t)
print(ans)

Submission status: Accepted

Solution code:
import sys
n = int(input())
t_ls = []
for i in range(n):
    t_ls.append(int(sys.stdin.readline().strip()))

def gcd(a, b):
    while a and b:
        if a < b:
            b %= a
        else:
            a %= b
    return max(a, b)

def scm(a, b):
    _gcd = gcd(a, b)
    return a * b // _gcd

res = 1
for t in t_ls:
    res = scm(res, t)
print(res)

Submission status: Accepted

Solution code:
n=int(input())
t=[int(input()) for i in range(n)]

from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

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

print(lcm_list(t))

Submission status: Accepted

Solution code:


import numpy as np

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

t=int(input())
ans=1
for _ in range(t):
    k=int(input())
    ans=ans*k//gcd(ans,k)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(input()) for i in range(n)]
import fractions 
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:
N = int(input())
T = []

for _ in range(N):
	T.append(int(input()))
	
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

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

Submission status: Accepted

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