시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 67 | 44 | 36 | 65.455% |
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”.
3 1 11 1 12 20 19 19 19 2 5 4 5
1/132 1/19 NOT NEIGHBORS