#P8647. [蓝桥杯 2017 省 AB] 分巧克力
[蓝桥杯 2017 省 AB] 分巧克力
Description
On Children’s Day, there are children visiting Xiaoming’s home. Xiaoming takes out his treasured chocolates to treat them.
Xiaoming has a total of chocolate bars. The -th bar is a rectangle made up of a grid of size .
To be fair, Xiaoming needs to cut out pieces of chocolate from these bars and give them to the children. The cut pieces must satisfy:
- The shape is a square, and the side length is an integer.
- All pieces are of the same size.
For example, a chocolate bar can be cut into pieces of chocolate, or pieces of chocolate.
Of course, the children all want the chocolate to be as large as possible. Can you help Xiaoming compute the maximum possible side length?
Input Format
The first line contains two integers and . .
The next lines each contain two integers and . .
The input guarantees that each child can get at least one piece of chocolate.
Output Format
Output the maximum possible side length of the square chocolate pieces that can be cut.
2 10
6 5
5 6
2
Hint
Lanqiao Cup 2022 Provincial Contest Group A Problem I.
Translated by ChatGPT 5
京公网安备 11011102002149号