发布网友 发布时间:2022-04-24 15:37
共1个回答
热心网友 时间:2023-10-19 19:51
Private Sub ni_Click()
End Sub
Public Function GetHLS(A() As Integer) As Double
If UBound(A) = 1 Then
GetHLS = A(0, 0) * A(1, 1) - A(0, 1) * A(1, 0)
End If
If UBound(A) > 1 Then
Dim RRes As Double
Dim LRes As Double
Dim CNum As Integer
Dim TNum As Double
Dim i As Integer
RRes = 0
LRes = 0
For i = 0 To UBound(A)
CNum = i
TNum = 1
If i = 0 Then
For j = 0 To UBound(A)
TNum = TNum * A(j, j)
Next j
End If
If i > 0 Then
Call YD(i)
For j = 0 To UBound(A)
TNum = TNum * A(j, cc(j))
Next j
End If
RRes = RRes + TNum
Next i
For i = 0 To UBound(A)
CNum = i
TNum = 1
If i = 0 Then
For j = 0 To UBound(A)
TNum = TNum * A(j, UBound(A) - j)
Next j
End If
If i > 0 Then
Call YD(i)
For j = 0 To UBound(A)
TNum = TNum * A(UBound(A) - j, cc(j))
Next j
End If
LRes = LRes + TNum
Next i
GetHLS = RRes - LRes
End If
End Function
Public Sub YD(N As Integer)
Dim n1 As Integer
n1 = UBound(aa)
ReDim bb(n1)
ReDim cc(n1)
For i = 0 To n1 - N
bb(i) = aa(N + i)
Next
For i = 0 To n1 - N
cc(i) = bb(i)
Next
For i = n1 - N + 1 To n1
cc(i) = aa(i - n1 + N - 1)
Next
End Sub