題目來源:judgegirl from ntu prof. pangfeng Liu
Task Description
Write a program to solve a system of equations. In particular we are given an by upper triangular matrix and a by vector , and we would like to find another by vector so that . Since is upper triangular, i.e., all the elements below the diagonal are zero, we can use a simple procedure called backward substitution to get the vector . Since , so we conclude that . Since we know now, we can easily compute , then , and so on, until we finally compute .
Input
The first line of the input has the number of rows and columns . is between 1 and 16. Each of the following lines has double numbers in . Each of the following lines has the numbers in . Note that all elements of matrix and vector are double numbers.
Output
The output has lines.
Each line is a number in .
You should output the double numbers in %f\n
format.
Sample input
3
1.0 2.0 3.0
0.0 2.0 1.0
0.0 0.0 4.0
2.0
3.0
-4.0
Sample output
1.000000
2.000000
-1.000000