14280 - Fraction Comparator   

Description

Your task is to create a fraction comparator that can handle the comparison of two fraction formulas that contain only addition.

In the provided code, you are advised to use a structure called "FractionList", which functions similarly to a linked list. When performing an addition, add the new fraction to the end of the list. Then, sums up all the fractions in each list and compares the result in the end.

This is a partial judge problem. Please review the provided code and refer to the sections labeled "TODO" in the function.h file for further details.

Important: Please select C++17 to submit your solution.

 

Input

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_n> <operator> <fraction_1> + ... + <fraction_m> ->  (5 ≤ n, m < 10)

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. The operators for each test case can be either "<", ">", "<=", or ">=".

 

Output

For each test case, output one line: If the given expression is true, output "True". Otherwise, output "False".

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

14280.cpp

Partial Judge Header

14280.h


Discuss