#P10415. [蓝桥杯 2023 国 A] 切割
[蓝桥杯 2023 国 A] 切割
Background
Data provided by: https://www.luogu.com.cn/discuss/838792.
Problem Description
Given a rectangle, where both side lengths are integers. Xiaolan wants to cut it into many small squares with integer side length. Assume there is no loss during cutting. The side length of each square must be at least , leftovers are not allowed, and all squares must have the same size. What is the maximum number of squares that can be cut?
Input Format
Input one line containing two integers , separated by a space.
Output Format
Output one line containing one integer, the answer. If there is no feasible plan that meets the requirements, output .
10 20
50
6 9
6
8 13
0
Hint
Sample Explanation 1
Cut into squares with side length .
Constraints
For of the testdata, .
For of the testdata, .
For all testdata, .
Translated by ChatGPT 5