PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000077. Tìm số bổ sung để đạt BCNN cho trước (Finding 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 số bổ sung để đạt BCNN cho trước (Finding LCM)
Finding LCM
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
You are given positive integers , , and . Find the smallest positive integer such that . If no such positive integer exists, print the lowercase word impossible.
Input
A line containing three integers , , .
Output
Print the minimum value , or impossible if there is no solution.
Subtasks
-
Subtask 1 (20 points): , .
-
Subtask 2 (30 points): , .
-
Subtask 3 (50 points): , .
Examples
Input
3 5 30
Output
2
Explanation
. With the LCM would only be , so is the smallest possible value.