![]() |
||||||||||
|
||||||||||
The Confusion of EuclidTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1 Accepted Submission(s): 1 Problem Description When Euclid invented his Euclid Algorithm to calculate the greatest common divisor of two integers, he also wanted to solve a more complex problem of greatest common fractional divisor(GCFD). That is to say, You will be given two fractions. Please find the largest fraction which can be divided by both of the two fractions. Input The first line contains an integer T (T <= 100) indicating the number of test cases. For each test case, there are one line contains two fractions described by standard form. The standard form is "numerater/denominator" and GCD(numerater,denominator) is equal to 1. For example, 2/1, 4/3 are in standard form.(0 < numerater <= 1000, 0 < denominator <= 1000) Output For each test case, please output one line of the GCFD in standard form. Sample Input
Sample Output
Source | ||||||||||
|