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

16270번 - Small Numbers 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB137453534.653%

문제

Little Vlad has two favorite numbers a and b. Recently, he was taught in school the division and multiplication operations and he immediately started dividing and multiplying his favorite numbers.

He wrote a and b in his notebook and came up with three cool operations which he wants to perform on his numbers:

  • Divide both numbers by one of their common divisors;
  • Divide a by one of his divisor g, multiply b by g;
  • Divide b by one of his divisor g, multiply a by g.

After performing every operation he erases his old numbers, replacing them with new ones. He may choose to continue performing operations or to stop.

Since Vlad is small, he wants numbers to be smaller. Thus, he is trying to minimize sum of a and b, but can't handle it on his own. Help him to determine minimum sum that he can obtain by performing these operations and give an example of final a and b with such sum.

입력

Input data contains multiple test cases. The first line of input contains integer t — the number of test cases (1 ≤ t ≤ 500).

Each test case is described by a single line containing integers a and b (1 ≤ a, b ≤ 109) — Vlad's favorite numbers.

출력

For each test case output one line — the pair with the minimum sum that can be obtained by performing operations from the list.

제한

예제 입력 1

2
4 5
4 6

예제 출력 1

1 5
2 3

힌트

출처

Contest > Russian Code Cup > 2017 > RCC 2017 Elimination Round A번

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

출처

대학교 대회

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

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