|
||||||||||
Find a FractionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 434 Accepted Submission(s): 93 Problem Description Given two non-negative rational numbers A and B(A<B), your task is to find a fraction between (A,B). Maybe there're many fractions in this interval. In this condition, output the fraction with the smallest sum of its denominator and molecular. Input The first line is an integer T(<=25) indicating the case number. The next T lines each contains two strings, namely A and B. A rational number contains characters '0'~'9','.','[',']' only. Digits between '[' and ']' are recurring decimal's cycle parts.(0.[6] = 0.666...,etc.) You may assume the input are all logical, and all the strings are no more than 16. Output For each case, output a fraction(as the format below) with the smallest sum of its denominator and molecular. Sample Input
Sample Output
Author MadFrog Source | ||||||||||
|