def gcd(A,B):
if not A%B:
return B
return gcd(B,A%B)
N, M = map(int,input().split())
ab = M//N
list_a = []
last_N = int(ab**(1/2))
for number_a in range(last_N,0,-1):
if not ab%number_a:
number_b = ab//number_a
if gcd(number_a,number_b) == 1:
list_a.extend([number_a,number_b])
break
print(*[ i*N for i in list_a])

 

'알고리즘 > 백준_복기_미완료' 카테고리의 다른 글

[BOJ/백준] 2666 벽장문의 이동  (0) 2021.05.03
[BOJ/백준] 2458 키순서  (0) 2021.05.03
[BOJ/백준] 2122 센서  (0) 2021.05.02
[BOJ/백준] 2156 포도주 시식  (0) 2021.05.02
[BOJ/백준] 2141 우체국  (0) 2021.05.02

+ Recent posts