#2718. 区间最大公约数

区间最大公约数

Description

给定两个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">L,R,你可以任意选择两个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">x,y且满足<math xmlns="http://www.w3.org/1998/Math/MathML">LyR,并求出x,y的最大公约数。

请问在所有选法中,x,y最大公约数的最大值为多少?

Input Format

输入共一行,两个正整数表示<math xmlns="http://www.w3.org/1998/Math/MathML">L,R

Output Format

输出共一个整数,表示所求答案
23 29
4

Hint

说明:
选(24,28)时,取到最大值为 4
输入2:
32678 65536
输出2:
32768
输入3:
32768 32769
输出3:
1

数据范围

  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">30%的数据,1LR100
  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">60%的数据,1LR103
  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">100%的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1LR5×105

Source

上海市2023年5月 枚举 数学