Hide

Problem D
Partial 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$. For variables for which there are more than one possible value, output “?”. If the system is inconsistent, output “inconsistent”.

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.20
? ? 1.00
inconsistent

Please log in to submit a solution to this problem

Log in