joj1062

1062: Computer Versus Mankind


ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE
3s8192K24741147Standard

Mike is a fan on programming. He's sure that computer can do everything faster than mankind does if a kind of task is repeated certain amount of times. Now he is proving this conclusion by calculate the gcd and lcm of two positive integers a and b, where a,b>1.

The gcd of two positive integers a and b, where a,b>1, is the greatest common dividor of them. The lcm of two positive integers a and b, where a,b>1, is the least common multiple of them. For example, the gcd of 6 and 8 is 2 while the lcm of them is 24.

Input Specification

The input consists of multilines, each line consists of two integers a and b(0<a,b<231), separated by a single space. a=b=0 marks the end of input, which you shouldn't process.

Output Specification

For each pair a and b in the input, you should output the gcd and lcm on a single line, separated by a single space too.

Sample Input

6 8
5 2
0 0

Sample Output

2 24
1 10

Problem Source: 1st JOJ Cup Online VContest Warmup Problem


This problem is used for contest: 75 


Submit / Problem List / Status / Discuss


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值