According to the simple column equation, we can list n+1 of n-element 2-th equation.
By subtracting the adjacent two equations, we can get N-n-ary 1-th equation, and the Gaussian elimination element can be done.
1 varB:Array[0.. -,0.. -] ofextended;2Temp,ans:Array[0.. -] ofextended;3 I,j,k,n:longint;4 cnt:extended;5 begin6 READLN (n);7 fori:=1 ton+1 Do8 forj:=1 toN Do9 read (b[i,j]);Ten fori:=1 toN Do One forj:=1 toN Do A begin -a[i,j]:=2* (b[i+1, j]-b[i,j]); -a[i,n+1]:=a[i,n+1]+b[i+1, j]*b[i+1, j]-b[i,j]*B[i,j]; the End; ---------------------------------rpcardinal Orz-------------------------------------- - fori:=1 toN-1 Do - begin + forj:=i+1 toN Do - ifA[j,i]>a[i,i] Then + begin Atemp:=A[i]; ata[i]:=A[j]; -a[j]:=temp; - End; - forj:=i+1 toN Do - begin -Cnt:=a[j,i]/a[i,i]; a[j,i]:=0; in fork:=i+1 ton+1 Do -a[j,k]:=a[i,k]*cnt-A[j,k]; to End; + End; -ans[n]:=a[n,n+1]/A[n,n]; the fori:=n-1 Downto 1 Do * begin $ forj:=i+1 toN Doa[i,n+1]:=a[i,n+1]-ans[j]*A[i,j];Panax Notoginsengans[i]:=a[i,n+1]/A[i,i]; - End; the fori:=1 toN DoWrite (Ans[i]:0:3,' '); + End.
Jsoi Spherical space Generator (Gaussian elimination element)