QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 32 MB 總分: 50

#16995. 地板

统计

Ivica 在他的房间里铺了新的木地板。房间长 $L$ 分米,宽 $W$ 分米。

地板砖是正方形的,每块的面积为 $1$ 平方分米。在 Ivica 铺好由棕色地板砖组成的地板后,他决定将房间边缘的地板砖染成红色。

下图展示了样例 2 的情况——外侧的地板砖是红色的,而剩下的两块内侧地板砖是棕色的:

Marica 来拜访 Ivica。当 Ivica 给她端上饼干时,她数了数每种颜色的地板砖数量。回到家后,她想起了这两个数量,并希望计算出 Ivica 房间的尺寸。请帮帮她!

输入格式

输入仅包含一行,有两个由空格隔开的整数 $R$(红色地板砖的数量)和 $B$(棕色地板砖的数量)。

输出格式

输出仅包含一行,分别为房间的尺寸 $L$ 和 $W$。如果这两个数不相等,请先输出较大的那个。测试数据保证总是存在唯一解。

数据范围

  • $8 \le R \le 5000$
  • $1 \le B \le 2\,000\,000$

子任务

在占总分 30% 的测试数据中,Ivica 房间的尺寸 $L$ 和 $W$ 将相等。

样例

输入样例 1

8 1

输出样例 1

3 3

输入样例 2

10 2

输出样例 2

4 3

输入样例 3

24 24

输出样例 3

8 6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.