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

26503번 - Neighbor 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB130867565.217%

문제

Two fractions are considered “neighbors” if the numerator of the reduced positive difference between the two fractions is 1. For example, the fractions 1/11 and 1/12 subtract to be 1/132, and are therefore “neighbors”. However, 2/5 and 4/5 differ by 2/5, and are not neighbors. Determine and output either the “neighbor” fraction value, or output “NOT NEIGHBORS”.

입력

The first line of input contains a single positive integer, n, indication the number of data sets. Each data set is comprised of the positive integer values for two fractions, all on one line, in the order numerator, denominator, numerator, denominator, separated by single spaces.

출력

The positive “neighbor” difference between the two fractions or the phrase “NOT NEIGHBORS”.

제한

예제 입력 1

3
1 11 1 12
20 19 19 19
2 5 4 5

예제 출력 1

1/132
1/19
NOT NEIGHBORS

힌트

출처

School > PLU High School Programming Contest > PLU 2016 > Advanced 9번

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

출처

대학교 대회

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

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