F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Confusion of Euclid

Time 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
2 1/2 1/3 7/2 21/4
 

Sample Output
1/6 7/4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-03-28 22:09:20, Gzip enabled