11603 - 231001_10/19_practice5-1
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
Input two integers n1 and n2. Find the greatest common divisor(最大公因數) and the least common multiple(最小公倍數) between n1 and n2.
The most common way to find the GCD is Euclidean algorithm, in other words, 輾轉相除法
Ex: n1=36, n2=15
36 = 15 × 2 + 6
15 = 6 × 2 + 3
6 = 3 × 2 + 0 → GCD = 3
LCM = (n1×n2) ÷ GCD
Input
Two integers n1 and n2
Output
Output: GCD and LCM
Output format:
-
See the sample output.
-
There is a space before and after “=”
Tags