PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000039. Ước chung lớn nhất và bội chung nhỏ nhất (GCD and LCM)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Ước chung lớn nhất và bội chung nhỏ nhất (GCD and LCM)
GCD and LCM
Source: CodeChef
Version: Phuoc Hung OJ Extended
Problem Statement
Given two positive integers , compute both their greatest common divisor (GCD) and least common multiple (LCM).
Input
One line contains .
Output
Print the GCD followed by the LCM separated by one space.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
12 18
Output
6 36
Explanation
The GCD of and is and their LCM is .