2024-05-19 06:44:05
2024-05-19 05:43:29
2024-05-19 00:38:08
Private Sub Command1_Click()
Dim M As Integer
Dim N As Integer
'这里设置最大1000维,需要更大可自己更改
M = Val(Text1.Text)
N = Val(Text2.Text)
Dim det1(1 To 1000, 1 To 1000) As Double
'初始化
'Randomize
Dim i As Integer, j As Integer
For i = 1 To M Step 1
For j = 1 To N Step 1
det1(i, j) = 1 ' Rnd * 100
Next
Next
'求周边元素结果
Dim result As Double
result = 0
For i = 1 To M Step 1
For j = 1 To N Step 1
If (i = 1) Or (j = 1) Or (i = M) Or (j = N) Then result = result + det1(i, j)
Next
Next
Text3.Text = result
End Sub