SP22319 POLYTABL - Polynomial Table
Description
Given a polynomial, your task is to print a table of some of its calculated values.
Input Format
Input starts with a positive integer t
Output Format
For every testcase print a table with the polynomial's values as shown in the example below. The output for every testcase consists of nine lines. The first and the last line are an identical sequence of dashes. All other lines start and end with "|", columns are also separated by "|" resp. "+" in the fifth line that separates the rows. The leftmost column contains x in the top row and the polynomial (exactly as given in the input) in the bottom row. The other columns are filled with the x-values in the top row in increasing order and the corresponding y-values in the bottom row. The width of a column depends on the maximum width of the values inside (may be in the top or bottom row) plus an additional space to the left and to the right. If the corresponding value in the other row needs less space, it is aligned to the right.
Regardless of the type of value – integer or fraction – the rows are always three lines in height. Integer values, fraction bars and signs are always printed in the middle line, numerator and denominator one line above resp. below. Fractions must be printed in lowest terms. If the value of a fraction is an integer value, it has to be printed as integer. No (intermediate) value will have an absolute value larger than 10¹⁸, if calculations are done carefully. The width of the fraction bar and alignment of numerator resp. denominator follow the same rules as explained in the input section. _Print a blank line after every testcase except the last one._
Note: The "exact judge" is used here, so the output format must be precisely observed.