PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000089. Tìm số B nhỏ nhất theo BCNN (Benefit)
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 nhỏ nhất theo BCNN (Benefit)
Benefit
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given two positive integers and , find the smallest positive integer satisfying . If no positive integer satisfies this equation, print the required impossibility token.
Input
One line containing two positive integers and .
Output
Print the smallest positive integer , or NO SOLUTION if none exists.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
32 1760
Output
55
Explanation
We have and . Since already supplies , the minimum additional factors are . Thus .