ACM Regional Programming Contest 1998
Problem No.  1  - Linear Equations
Executable Program: PROG1.EXE,  PROG1.CLASS
Source Program: PROG1.CPP, PROG1.C, PROG1.JAVA PROG1.PAS
Input file: IN.TXT   Output file: OUT.TXT
 
 

Problem Description:
Write a program to solve a set of linear equations.

Input File Format:

    The first line contains the number of systems (problems) to be solved.
For each problem to be solved a line contains the number of variables in that system, N. the next N lines are the system representation. Each system is represented by a N by N+1 matrix representing the coefficients for each unknown variable with the N+1 column representing the right-hand side of the equations. coefficients will be real numbers with a fractional part between three and seven decimals long. Each matrix row will use a line in the input file. All systems can be though as the addition of positive and negative numbers.
Problems follow each other (no blank lines separate them).
 

Output File Format:

    A line for each problem with the solution for each variable separated by a single space. Express each value with three decimals, the first two are relevant, the third one may be anything. A single line, with the text: "NO SOLUTION" ,without quotes, is expected when a unique solution doesn't exist for the system.
 

Notes: Each system will have at least 2 and at most 4 unknown variables.

Example:
 The input/output files for solving a single system follows:

1.000X1 + 0.500X2 + 0.3333333X3+0.250X4= 0.1666667
0.500X1 + 0.3333333X2+ 0.250X3+ 0.200X4= 0.1428571
0.3333333X1 + 0.250X2+ 0.200X3+ 0.1666667X4 = 0.125
0.250X1 + 0.200X2 + 0.1666667X3+ 0.1428571X4= 0.1111111

Input file example:
1
4
1.000 0.500 0.3333333 0.250 0.1666667
0.500 0.3333333 0.250 0.200 0.1428571
0.3333333 0.250 0.200 0.1666667 0.125
0.250 0.200 0.1666667 0.1428571 0.1111111

Output file example:
**********************
* Team ##, Problem 1 *
**********************

-0.032 0.596 -2.382 2.779