-->
当前位置:首页 > 题库

PROGRAMMING:Jmu-java-m02-using two-dimensional array to store multiple linear equations

Luz5年前 (2021-05-10)题库550
#Questions
Two dimensional array storage can be used to store the coefficients and constants of linear equations. For example, for a system of linear equations with three variables
3x+y+z=1
6x+2y+z=-1
-2x+2y+z=7
It can be stored in a binary array
2 1 1 1
6 2 1 -1
-2 2 1 7
Write a program to store n-ary linear equations
###Input format:
The integer n represents n elements
The coefficients and constants of linear equations with n rows and N + 1 columns in each row. The coefficients and constants are of double type.
###Output format:
Format the output two-dimensional array. Note: use arrays. Deeptostring to format the output.
The coefficients and constants of n-line linear equations are output in turn. The coefficients are separated by, the coefficients and constants are separated by =, and there are two spaces between =.
###Input example:
```in
three
2 1 1 1
6 2 1 -1
-2 2 1 7
```
###Output example:
```out
[[2.0, 1.0, 1.0, 1.0], [6.0, 2.0, 1.0, -1.0], [-2.0, 2.0, 1.0, 7.0]]
2.0, 1.0, 1.0 = 1.0
6.0, 2.0, 1.0 = -1.0
-2.0, 2.0, 1.0 = 7.0
```






answer:If there is no answer, please comment