#P6483. [COCI 2010/2011 #4] PARKET
[COCI 2010/2011 #4] PARKET
Description
There is an by grid. The cells on the outer border are red, and all other cells are black.
Given the number of red cells and the number of black cells , find a feasible pair of values and .
Input Format
The input consists of one line with two integers, representing the number of red cells and the number of black cells .
Output Format
Output one line with two integers, representing the number of rows and the number of columns of the grid. If there are multiple solutions, output the one with the largest .
8 1
3 3
10 2
4 3
24 24
8 6
Hint
Explanation of Sample 2
The output grid is shown in the figure: light-colored cells represent red, and dark-colored cells represent black.

Constraints
For all testdata, it is guaranteed that and . It is guaranteed that at least one solution exists.
Note
This problem is translated from COCI2010-2011 CONTEST #4 T2 PARKET. Translation by @一扶苏一.
Translated by ChatGPT 5
京公网安备 11011102002149号