|
??? |
|
Option Explicit
Sub Macro1() Sheets("Sheet1").Select Cells(1, 1).Value = 0 Dim x1 As Integer, y1 As Integer, z1 As Integer 'SのCに対する勝敗分数 Dim x2 As Integer, y2 As Integer, z2 As Integer 'NのCに対する勝敗分数 Dim z1z2 As Integer 'z1+z2 Dim gyou As Integer 'Sの勝率 '(8+x1)/((8+x1)+(4+y1))=6/10=3/5 ' → 40+5*x1=36+3*x1+3*y1 → y1=(4+2*x1)/3 'Nの勝率 '(4+x2)/((4+x2)+(8+y2))=5/10=1/2 ' → 8+2*x2=12+x2+y2 → y2=x2-4 'Cの勝率 '(y1+y2)/((y1+y2)+(x1+x2))=4/10=2/5 ' → 5*(y1+y2)=2*(x1+x2)+2*(y1+y2) → 2*(x1+x2)=3*(y1+y2) '総試合数 '((8+x1)+(4+y1)+(2+z1))+((4+x2)+(8+y2)+(2+z2))+((y1+y2)+(x1+x2)+(z1+z2))=47*2 ' → z1+z2=33-(x1+x2)-(y1+y2) 'Cの勝数=引分総数 '(2+z1)+(2+z2)+(z1+z1)=2*(y1+y2) ' → z1+z2=y1+y2-2 For x1 = 0 To 47 - (8 + 4 + 2) y1 = Int((4 + 2 * x1) / 3) If 3 * y1 = 4 + 2 * x1 Then For x2 = 4 To 47 - (8 + 4 + 2) - (x1 + y1) y2 = x2 - 4 z1z2 = 33 - (x1 + x2) - (y1 + y2) If z1z2 = y1 + y2 - 2 Then For z1 = 0 To z1z2 z2 = z1z2 - z1 Cells(1, 1).Value = Cells(1, 1).Value + 1 gyou = 4 * Cells(1, 1).Value - 3 Cells(gyou, 2).Value = "S" Cells(gyou, 3).Value = 8 + x1 Cells(gyou, 4).Value = 4 + y1 Cells(gyou, 5).Value = 2 + z1 Cells(gyou + 1, 2).Value = "N" Cells(gyou + 1, 3).Value = 4 + x2 Cells(gyou + 1, 4).Value = 8 + y2 Cells(gyou + 1, 5).Value = 2 + z2 Cells(gyou + 2, 2).Value = "C" Cells(gyou + 2, 3).Value = y1 + y2 Cells(gyou + 2, 4).Value = x1 + x2 Cells(gyou + 2, 5).Value = z1 + z2 Range("C" & (gyou + 2)).Select Next z1 End If Next x2 End If Next x1 End Sub |
|
5月24日(木) 10:23:21
39375 |