Your task is to create a basic fraction calculator that can handle the multiplication of fractions.
In the provided code, you are advised to use a structure called "FractionList", which functions similarly to a linked list. When performing a multiplication, add the new fraction to the end of the list. Then, multiply all the fractions in the list and output the answer.
This is a partial judge problem. You need to implement 3 class methods. Please review the provided code and refer to the sections labeled "TODO" in the function.h file for further details.
The first line of the input contains an integer N, representing the number of test cases. (1 ≤ N ≤ 5 × 104)
Each of the following N lines represents a test case.
Each test case contains a sequence of fractions and operations formatted as follows:
<fraction_1> * <fraction_2> * ... * <fraction_n> =
(1 < n ≤ 15)
Each fraction is written in the format <numerator>/<denominator>
, where both numerator and denominator, as well as all numbers involved in calculations, fit within the range of a long long data type.
For each test case, you should output the original problem and the result, with resulting fraction presented as a simplified fraction reduced to its lowest terms. The format for each test case should be as follows:
<fraction_1> * <fraction_2> * ... * <fraction_n> = <result_fraction>
Additional constraint:
3/1
.