P27697 [洛谷] [LanQiao Cup 2023 National A] Cutting
普及
题目描述

Problem Description

Given a rectangle with dimensions $W \times H$, where both sides are integers. Xiao Lan wants to cut it into many small squares with integer sides. Assuming there is no waste, the side length of the squares must be at least $2$, and no leftover material is allowed. All squares must be of equal size. How many squares can be cut out at most?

Input Format

The input consists of a single line containing two integers $W$ and $H$, separated by a space.

Output Format

The output consists of a single line containing an integer representing the answer. If there is no feasible solution, output $0$.

Sample Input and Output

Sample Input #1

10 20

Sample Output #1

50

Sample Input #2

6 9

Sample Output #2

6

Sample Input #3

8 13

Sample Output #3

0

Notes

[Sample Explanation 1]

Cut into $5 \times 10 = 50$ squares with side length $2$.

[Evaluation Test Case Scale and Constraints]

For $30\%$ of the test cases, $1 \le W, H \le 1000$;
For $60\%$ of the test cases, $1 \le W, H \le 10^6$;
For all test cases, $1 \le W, H \le 10^9$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10 20
样例输出
50