포럼
문제 COCI00170

Parket

설명

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.

For example, in a room of size \(4 \times 3\) the 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 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), with \(8 \le R \le 5000\) and \(1 \le B \le 2\,000\,000\).

출력 형식

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.

Scoring: In test cases worth \(30\%\) of total points, the dimensions \(L\) and \(W\) will be equal.

서브태스크
서브태스크점수설명

Test 1

10점

None

Test 2

10점

None

Test 3

10점

None

Test 4

10점

None

Test 5

10점

None

Test 6

10점

None

Test 7

10점

None

Test 8

10점

None

Test 9

10점

None

Test 10

10점

None

예제 1
입력
8 1
출력
3 3
예제 2
입력
10 2
출력
4 3
예제 3
입력
24 24
출력
8 6
문제 정보

riseoj 작성

출처 COCI 2010/2011 Contest 4

평가 및 의견

Parket

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Parket

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8