Problem G
Linear Equation Solver
Input
There are several test cases. Each test case begins with a line containing an integer $n$, where $1 \leq n \leq 100$.
Then follow $n$ lines, each containing $n$ floating point numbers. The $j$:th number on the $i$:th row gives the entry $a_{i,j}$ of the matrix $A$. Then follows one line containing $n$ floating point numbers, the $i$:th of which is the $i$:th element of the vector $b$.
The input is ended with a case where $n = 0$.
Output
For each operation in each test case, output the vector $x$ giving the solution to the system of equations $Ax = b$. If there are multiple vectors $x$ solving the equations, output “multiple”. If the system is inconsistent, output “inconsistent”.
The entries of $x$ are allowed to have an error of at most $10^{-3}$.
Sample Input 1 | Sample Output 1 |
---|---|
2 1 1 0 1 23 42 1 5 1 3 1 -2 0 2 -4 0 1 -2 1 3 6 4 3 1 1 0 3 3 0 0 1 2 1 4 8 0 |
-19 42 0.2 multiple inconsistent |