GCD Factor
Problem Description
計算兩數的最大公因數GCD並計算GCD所有因數的和。
Input Format
第一行是測資筆數,
。每筆測資一行,包含兩個正整數
與
,其中
,
都不超過
。
Output Format
每筆測資輸出一行,先輸出GCD,再輸出GCD的所有因數總和。例如,
,則
,而
的因數有
,所以因數和
。
Sample Input
2
6 24
20 37
Sample Output
6 12
1 1
留言