Linear System of Equations
InterviewTime limit2sMemory limit512 MB
Given N linear equations in N unknowns with a unique solution, find and print the values of x1 through xN.
- Level
Medium4 of 10
- Topics
- Math, Brute force, Implementation, Matrix
- Solved
- No attempts yet
Problem
An equation whose highest degree in each unknown is at most 1 is called a linear equation. In other words, it has the following form.
A linear system of equations is a finite collection of linear equations. For example:
Given a linear system of equations, write a program that finds its solution.
Only inputs with a unique solution are given, and every solution value is a natural number at most 100.
Input
The first line gives the number of unknowns (2 ≤ ≤ 6).
Each of the next lines gives integers (1 ≤ ≤ 10) describing one equation.
Output
Print through in order, separated by a single space.