|
??? |
|
Option Explicit : Dim a(8) As Integer
Sub Macro1() Cells(1, 1).Value = 0 Call saiki(1) End Sub Sub saiki(ByVal n As Integer) Dim max As Integer, j As Integer If n <= 2 Then a(n) = 0 : max = 1 ElseIf n <= 5 Then If a(n - 2) = a(n - 1) Then a(n) = 1 - a(n - 1) : max = a(n) Else a(n) = 0 : max = 1 End If ElseIf n = 6 Then a(n) = 1 - a(n - 1) : max = a(n) Else a(n) = a(n - 1) : max = a(n) End If While a(n) <= max If n < 8 Then Call saiki(n + 1) Else Cells(1, 1).Value = Cells(1, 1).Value + 1 For j = 1 To 8 Cells(Cells(1, 1).Value, j + 1).Value = s(a(j)) Next j End If a(n) = a(n) + 1 Wend End Sub Private Function s(ByVal n As Integer) As String If n = 0 Then s = "H" Else s = "T" End Function |
|
9月11日(木) 11:45:55
42365 |