A1207 | [COCI-2010_2011-contest4]#5 PARKET
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Ivica has set up a new parquet flooring in his room. The room is L decimeters long and W decimeters wide.
The blocks are of quadratic shape and each has an area of one quadratic decimeter. Once Ivica had set up the flooring, which consists of brown-colored blocks, he decided to paint the blocks on the edge of the room red.
The picture below illustrates the scenario from the test case #2 – outer blocks are red, while the remaining two inner blocks are brown:
Marica has come to visit Ivica. While Ivica was serving her cookies, she counted the number of blocks of each color. When she returned home, she recalled of the two numbers and wished to calculate the dimensions of Ivica’s room. Help her!
The blocks are of quadratic shape and each has an area of one quadratic decimeter. Once Ivica had set up the flooring, which consists of brown-colored blocks, he decided to paint the blocks on the edge of the room red.
The picture below illustrates the scenario from the test case #2 – outer blocks are red, while the remaining two inner blocks are brown:
Marica has come to visit Ivica. While Ivica was serving her cookies, she counted the number of blocks of each color. When she returned home, she recalled of the two numbers and wished to calculate the dimensions of Ivica’s room. Help her!
输入格式
The first and only line of input contains two integers separated by a space, R (the number of red blocks) and B (the number of brown blocks). The following constraints will apply: 8 ≤ R ≤ 5000, 1 ≤
B ≤ 2 000 00
0.
B ≤ 2 000 00
0.
输出格式
The first and only line of output must contain the dimensions of the room, L and W, respectively. If the numbers differ, output the greater one first. The test data will ensure that a unique solution always exists.
输入输出样例
输入 #1
8 1
输出 #1
3 3
输入 #2
10 2
输出 #2
4 3
输入 #3
24 24
输出 #3
8 6
In test cases worth 30% of total points, the dimensions of Ivica’s room, L and W, will be equal.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted