#abc296d. D - M<=ab
D - M<=ab
Score : points
问题陈述
给定两个正整数 和 。
找出满足以下两个条件的最小正整数 ,若不存在这样的整数,则输出 。
- 可以表示为两个在闭区间 到 内(包括两端点)的整数 和 的乘积。这里, 和 可以是相同的。
- 至少为 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given positive integers and .
Find the smallest positive integer that satisfies both of the conditions below, or print if there is no such integer.
- can be represented as the product of two integers and between and , inclusive. Here, and may be the same.
- is at least .
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the smallest positive integer that satisfies both of the conditions, or if there is no such integer.
Sample Input 1
5 7
Sample Output 1
8
First, cannot be represented as the product of two integers between and .
Second, can be represented as the product of two integers between and , such as .
Thus, you should print .
Sample Input 2
2 5
Sample Output 2
-1
Since , , , and , only , , and can be represented as the product of two integers between and , so no number greater than or equal to can be represented as the product of two such integers.
Thus, you should print .
Sample Input 3
100000 10000000000
Sample Output 3
10000000000
For , the product of and is , which is the answer.
Note that the answer may not fit into a -bit integer type.
update @ 2024/3/10 12:18:10