We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importmathimportosimportrandomimportreimportsysfromfunctoolsimportreduceif__name__=='__main__':first_multiple_input=input().rstrip().split()n=int(first_multiple_input[0])k=int(first_multiple_input[1])A=list(map(int,input().rstrip().split()))x=reduce(lambdaa,b:math.gcd(a,b),A)t=2whilet<=math.trunc(x**0.5):ifx%t==0:breakelse:t+=1print(t*(k//t)) if t<=math.trunc(x**0.5) else print(x*(k//x))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Easy GCD
You are viewing a single comment's thread. Return to all comments →