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