C - Remainder Minimization 2019
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
非負整数 が与えられます。 つの整数 を を満たすように選びます。 の最小値を求めてください。
制約
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
条件を満たすように を選んだ時の、 の最小値を出力せよ。
入力例 1Copy
Copy
2020 2040
出力例 1Copy
Copy
2
とすると、 となります。
入力例 2Copy
Copy
4 5
出力例 2Copy
Copy
20
選び方は の 通りしか存在しません。
Score : points
Problem Statement
You are given two non-negative integers and . We will choose two integers and such that . Find the minimum possible value of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum possible value of when and are chosen under the given condition.
Sample Input 1Copy
Copy
2020 2040
Sample Output 1Copy
Copy
2
When , .
Sample Input 2Copy
Copy
4 5
Sample Output 2Copy
Copy
20
We have only one choice: .