End If
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
If w(i, j) = "-" And i <> k And j <> r And i <> k1 And j <> r1 And i <> k2 And j <> r2 And i <> k3 And j <> r3 Then
l4 = postavka(i, j): k4 = i: r4 = j: Exit For
End If
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
If w(i, j) = "-" Then postavka(i, j) = postavka(i, j) - min(l, min(l1, min(l2, min(l3, l4))))
If w(i, j) = "+" Then postavka(i, j) = postavka(i, j) + min(l, min(l1, min(l2, min(l3, l4))))
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
Worksheets("Лист1").Cells(i + 15, j + 8) = postavka(i, j)
Next j
Next i
If a <= b Then
If min(l, min(l1, min(l2, min(l3, l4)))) = l Then Worksheets("Лист1").Cells(k + 6, r + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l1 Then Worksheets("Лист1").Cells(k1 + 6, r1 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l2 Then Worksheets("Лист1").Cells(k2 + 6, r2 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l3 Then Worksheets("Лист1").Cells(k3 + 6, r3 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l4 Then Worksheets("Лист1").Cells(k4 + 6, r4 + 8) = ".": Exit Sub
End If
If a > b Then
If min(l, min(l1, min(l2, min(l3, l4)))) = l Then Worksheets("Лист1").Cells(r + 6, k + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l1 Then Worksheets("Лист1").Cells(r1 + 6, k1 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l2 Then Worksheets("Лист1").Cells(r2 + 6, k2 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l3 Then Worksheets("Лист1").Cells(r3 + 6, k3 + 8) = ".": Exit Sub
If min(l, min(l1, min(l2, min(l3, l4)))) = l4 Then Worksheets("Лист1").Cells(r4 + 6, k4 + 8) = ".": Exit Sub
End If
End If
End Sub
Public Sub kontur5(a As Integer, b As Integer)
Dim p(1 To 7) As Double
Dim n(1 To 7, 1 To 7) As Double
Dim postavka(1 To 7, 1 To 7) As Double
Dim w(1 To 7, 1 To 7) As String
Dim z(1 To 5) As Double
Dim l As Double
Dim l1 As Double
Dim l2 As Double
Dim l3 As Double
For i = 1 To 7 Step 1
p(i) = Worksheets("Лист1").Cells(15, i)
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
n(i, j) = Worksheets("Лист1").Cells(i + 6, j + 15)
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
postavka(i, j) = Worksheets("Лист1").Cells(i + 15, j + 8)
Next j
Next i
If ((a = 1 And b = 4) Or (a = 4 And b = 1)) And p(1) <= p(4) Then z(1) = 4: z(2) = 5: z(3) = 2: z(4) = 7: z(5) = 1
If ((a = 1 And b = 4) Or (a = 4 And b = 1)) And p(1) > p(4) Then z(1) = 1: z(2) = 7: z(3) = 2: z(4) = 5: z(5) = 4
If ((a = 4 And b = 5) Or (a = 5 And b = 4)) And p(4) <= p(5) Then z(1) = 5: z(2) = 2: z(3) = 7: z(4) = 1: z(5) = 4
If ((a = 4 And b = 5) Or (a = 5 And b = 4)) And p(4) > p(5) Then z(1) = 4: z(2) = 1: z(3) = 7: z(4) = 2: z(5) = 5
If ((a = 2 And b = 5) Or (a = 5 And b = 2)) And p(2) <= p(5) Then z(1) = 5: z(2) = 4: z(3) = 1: z(4) = 7: z(5) = 2
If ((a = 2 And b = 5) Or (a = 5 And b = 2)) And p(2) > p(5) Then z(1) = 2: z(2) = 7: z(3) = 1: z(4) = 4: z(5) = 5
If ((a = 2 And b = 7) Or (a = 7 And b = 2)) And p(2) <= p(7) Then z(1) = 7: z(2) = 1: z(3) = 4: z(4) = 5: z(5) = 2
If ((a = 2 And b = 7) Or (a = 7 And b = 2)) And p(2) > p(7) Then z(1) = 2: z(2) = 5: z(3) = 4: z(4) = 1: z(5) = 7
If ((a = 1 And b = 7) Or (a = 7 And b = 1)) And p(1) <= p(7) Then z(1) = 7: z(2) = 2: z(3) = 5: z(4) = 4: z(5) = 1
If ((a = 1 And b = 7) Or (a = 7 And b = 1)) And p(1) > p(7) Then z(1) = 1: z(2) = 4: z(3) = 5: z(4) = 2: z(5) = 7
Worksheets("Лист3").Cells(min1(a, b) + 19, max1(a, b)) = "+"
s = 0
If p(a) <= p(b) And a <= b Then
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.