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

18673번 - Fractionstellar 다국어

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

문제

It’s 2050. Humans have already colonized Mars and other planets long time ago and there are already some programs for travelling to the other galaxies using wormholes. Scientists are currently studying the mysteries of the black holes. Their observations concluded that everything we know about physics and mathematics is completely different inside the black hole. For example, do you remember the greatest common divisor (GCD) and the lowest common multiple (LCM)? These functions are normally defined only on integers. The situation is different inside the black hole; GCD and LCM are also defined on rational numbers. For two rational numbers a/b and c/d: their GCD is the greatest rational number that divides both numbers to an integer, and their LCM is the lowest rational number that both numbers divide to an integer. For example, GCD(1/2, 1/3) = 1/6 and LCM(1/2, 1/3) = 1/1. Can you help the scientists in their missions solving out the mysteries of the black holes? Given two rational numbers, find their GCD and LCM inside the black hole.

입력

Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 1000). Followed by T test cases. Each test case contains four integers a, b, c, and d (1 ≤ a, b, c, d ≤ 2 × 109) representing the two rational numbers a/b and c/d.

출력

For each test case, print a single line containing two rational numbers ‘m/n’ and ‘x/y’, the GCD and the LCM of the two given rational numbers. m/n and x/y must be in their simplest form. In other words, the GCD(m, n) and GCD(x, y) must be 1.

제한

예제 입력 1

2
1 2 1 3
1 5 1 7

예제 출력 1

1/6 1/1
1/35 1/1

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > 2015 Arab Collegiate Programming Contest D번

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

출처

대학교 대회

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

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