码迷,mamicode.com
首页 > 其他好文 > 详细

POJ2429--GCD & LCM Inverse (UNSOLVED)

时间:2019-02-09 12:00:20      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:lang   sum   number   you   int   amp   multi   greatest   --   

Given two positive integers a and b, we can easily calculate the greatest common divisor (GCD) and the least common multiple (LCM) of a and b. But what about the inverse? That is: given GCD and LCM, finding a and b.

Input

The input contains multiple test cases, each of which contains two positive integers, the GCD and the LCM. You can assume that these two numbers are both less than 2^63.

Output

For each test case, output a and b in ascending order. If there are multiple solutions, output the pair with smallest a + b.

Sample Input

3 60

Sample Output

12 15

POJ2429--GCD & LCM Inverse (UNSOLVED)

标签:lang   sum   number   you   int   amp   multi   greatest   --   

原文地址:https://www.cnblogs.com/albert67/p/10357252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!