P29406 [洛谷] [COCI2010-2011#4] PARKET
普及
题目描述

Problem Description

There is a grid array with $n$ rows and $m$ columns. The outermost squares are red, and the remaining squares are black.

Given the number of red squares $r$ and the number of black squares $b$, please provide a feasible pair of values for $n$ and $m$.

Input Format

The input consists of a single line with two integers, representing the number of red squares $r$ and the number of black squares $b$ respectively.

Output Format

Output a single line with two integers, representing the number of rows $n$ and the number of columns $m$ of the grid array. If there are multiple solutions, output the one with the largest $n$.

Sample Input and Output

Sample Input #1

8 1

Sample Output #1

3 3

Sample Input #2

10 2

Sample Output #2

4 3

Sample Input #3

24 24

Sample Output #3

8 6

Notes

Sample 2 Explanation

The output grid array is illustrated below, where light squares represent red and dark squares represent black.

Image

Data Range and Constraints

For all test cases, it is guaranteed that $8 \leq r \leq 2 \times 10^6$ and $1 \leq b \leq 2 \times 10^6$. The data ensures that at least one solution exists.

Notes

The problem is translated from COCI2010-2011 CONTEST #4 T2 PARKET, translated by @一扶苏一.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
8 1
样例输出
3 3