This is a partial judge problem.
In this problem, you're asked to implement the following function that related to fraction arithmetic.
typedef struct { long long numerator; long long denominator; } Fraction;
First you have a struct binded with two integers which is the numerator and denominator of a fractrion.
Fraction CreateFrac(long long, long long);
Return a Fraction that its numerator is the first parameter and its demoniator is the second parameter.
void Reduction(Fraction*);
Reduce the fraction.
int Compare(Fraction, Fraction);
Compare two Fraction, if the first one is greater than the second one, return 1, otherwise return 0.
Fraction Add(Fraction, Fraction); Fraction Sub(Fraction, Fraction); Fraction Mul(Fraction, Fraction); Fraction Div(Fraction, Fraction);
For the above four function, you have to return the irreducible fraction that is the result of doing the corresponding calculation.
Add stands for addition, Sub stands for subtraction, mul stands for Multiplication, Div stands for Division.
For the source code of main.c and function.h you can refer to the attachment below.
You're highly recommended to create an additional file function.c and compile it with the main source code instead of putting everything in one file.
First line of the input contains one integer T (T <= 100000), representing the number of operation.
Next, input T lines. Each line contains one integer and two fraction.
The integer indicates which function to use.
Guarentee the numerator and denominator of the input fraciton is in the range of [1, 1000000] and the result fraction for each operation is positive non zero fraction.
For detail input format, you can refer to the source code.
Output the calculation result for each operation.