|
??? |
|
最低点を1点とすると、点のデータは次の4種類。
1,2,5,10,12 1,3,8,9,12 1,3,8,11,12 1,4,5,10,12 Option Explicit Dim a(5) As Integer Sub Macro1() Sheets("Sheet1").Select Cells(1, 1).Value = 101 Cells(2, 1).Value = 0 Range("A1").Select a(1) = 1 Call saiki(2) End Sub Sub saiki(ByVal n As Integer) Dim b(100) As Integer Dim dame As Integer Dim sa As Integer Dim j1 As Integer Dim j2 As Integer a(n) = a(n - 1) + 1 While a(n) <= 100 For j1 = 1 To 100 b(j1) = 0 Next j1 dame = 0 j1 = 1 While dame = 0 And j1 < n j2 = j1 + 1 While dame = 0 And j2 <= n sa = a(j2) - a(j1) b(sa) = b(sa) + 1 If b(sa) > 1 Then dame = 1 Else j2 = j2 + 1 End If Wend j1 = j1 + 1 Wend If dame = 0 Then If n < 5 Then Call saiki(n + 1) ElseIf Cells(1, 1).Value >= a(5) Then If Cells(1, 1).Value > a(5) Then Cells(1, 1).Value = a(5) Cells(2, 1).Value = 1 Columns("B:F").Select Selection.ClearContents Range("A1").Select Else Cells(2, 1).Value = Cells(2, 1).Value + 1 End If For j1 = 1 To 5 Cells(Cells(2, 1).Value, j1 + 1).Value = a(j1) Next j1 End If End If a(n) = a(n) + 1 Wend End Sub |
|
7月12日(木) 8:56:31
39576 |