|
??? |
|
三角形の判定基準を一番簡単にしてみました。
Option Explicit 'a,b,cが三角形の3辺をなす←→|a-b|<c<a+b Sub Macro1() Sheets("Sheet1").Select Cells(1, 1).Value = 0 Dim a As Integer Dim b As Integer Dim c As Integer For a = 1 To 16 - 2 For b = a + 1 To 16 - 1 For c = Application.Max(b + 1, Abs(a - b) + 1) To Application.Min(16, a + b - 1) Cells(1, 1).Value = Cells(1, 1).Value + 1 Cells(Cells(1, 1).Value, 2).Value = a Cells(Cells(1, 1).Value, 3).Value = b Cells(Cells(1, 1).Value, 4).Value = c Range("B" & Cells(1, 1).Value).Select Next c Next b Next a Range("A1").Select End Sub |
|
12月3日(木) 13:40:34
35439 |