21605_Number

2022-5-16 18:19| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505681718100-Problem List-采集的数据-后羿采集器.html

Pro.ID

21605

Title

Number

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21605

AC

22

Submit

102

Ratio

21.57%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Given the greatest common divisor (GCD) and the least common multiple (LCM) of two integers a and b ( ab ), please find the minimum of b-a.

    输入

    Input may consist of several test data sets. For each data set, it can be format as below: There is just one line containing two integers, the GCD and the LCM, both are between [1, 109].

    Input is ended by GCD = LCM = 0.

    输出

    Description

    Given the greatest common divisor (GCD) and the least common multiple (LCM) of two integers a and b ( ab ), please find the minimum of b-a.

    Input

    Input may consist of several test data sets. For each data set, it can be format as below: There is just one line containing two integers, the GCD and the LCM, both are between [1, 109].

    Input is ended by GCD = LCM = 0.

    Output

    For each data set, output one integer representing the minimum difference of a and b can be found, and then output a, then b, separated with only one space. If more than one pair of a and b can be found, output the one which has minimum a.

    Sample Input

    6 36
    1 35
    0 0

    Sample Output

    6 12 18
    2 5 7

    Source

    样例输入

    6 36
    1 35
    0 0

    样例输出

    6 12 18
    2 5 7

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部