#P10415. [蓝桥杯 2023 国 A] 切割

    ID: 11933 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>数学2023数论蓝桥杯国赛

[蓝桥杯 2023 国 A] 切割

Background

Data provided by: https://www.luogu.com.cn/discuss/838792.

Problem Description

Given a W×HW\times H 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 22, 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 W,HW, H, 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 00.

10 20
50
6 9
6
8 13
0

Hint

Sample Explanation 1

Cut into 5×10=505\times 10=50 squares with side length 22.

Constraints

For 30%30\% of the testdata, 1W,H10001\le W,H\le 1000.
For 60%60\% of the testdata, 1W,H1061\le W,H\le 10^6.
For all testdata, 1W,H1091\le W,H\le 10^9.

Translated by ChatGPT 5