PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000041. Tìm cặp số khi biết UCLN và BCNN (GCD 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
Tìm cặp số khi biết UCLN và BCNN (GCD LCM)
GCD LCM
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers , find positive integers such that and . Minimize . Print , or -1 if no pair exists.
Input
One line contains .
Output
Print or -1.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
3 12
Output
3 12
Explanation
Since is divisible by , the pair works and minimizes .