给定两个自然数 $A$ 和 $B$。求一个自然数 $N$,使得 $A + N$ 和 $B + N$ 的最小公倍数 $\text{LCM}(A + N, B + N)$ 最小。
输入格式
输入唯一的一行,包含两个自然数 $A$ 和 $B$。它们均不超过 $10^9$。
输出格式
输出使得 $\text{LCM}(A + N, B + N)$ 最小的自然数 $N$。如果有多个 $N$ 都能取得最小值,输出其中最小的那个。
样例
输入样例 1
4 10
输出样例 1
2
给定两个自然数 $A$ 和 $B$。求一个自然数 $N$,使得 $A + N$ 和 $B + N$ 的最小公倍数 $\text{LCM}(A + N, B + N)$ 最小。
输入唯一的一行,包含两个自然数 $A$ 和 $B$。它们均不超过 $10^9$。
输出使得 $\text{LCM}(A + N, B + N)$ 最小的自然数 $N$。如果有多个 $N$ 都能取得最小值,输出其中最小的那个。
4 10
2
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines: