Logo
(追記) (追記ここまで)

17547번 - Floor Plan 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB188857848.148%

문제

You are an architect and you have just been appointed to build a new swimming hall. The organisation behind these plans has acquired funding for a swimming pool and surrounding building as large as they want, but unfortunately they could not find anyone willing to pay for the floor surrounding the pool. They decided to pay for the floor tiles out of their own pocket. Because this has already cost them an arm and a leg, they want you to use all the floor tiles in your proposed plan.

Being an architect, you care for aesthetics. You see it as absolutely vital that both the swimming pool and the surrounding building are perfect squares. This raises an interesting problem: how can you make sure that the square shapes are guaranteed, while still using all the floor tiles the organisation bought?

Given the number of tiles n, find the length of the side of the building m and and the length of the side of the pool k such that n = m2 − k2, or print impossible if no suitable m and k exist.

입력

  • One line containing a single integer 1 ≤ n ≤ 109.

출력

Print two non-negative integers m, k such that n = m2 − k2, or print impossible if no such integers exist. If there are multiple valid solutions, you may output any one of them.

제한

예제 입력 1

7

예제 출력 1

4 3

예제 입력 2

10

예제 출력 2

impossible

예제 입력 3

15

예제 출력 3

4 1

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2019 Preliminaries F번

  • 문제를 만든 사람: Mees de Vries
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /