足球池的组合数量

时间:2013-09-02 19:52:06

标签: algorithm excel function vba excel-vba

我在VBA中开发了一个宏,它结合了三个足球池,代表了27种不同的组合。图27表示最大可能的投注组合。我想修改列表以开发具有双重,固定,三重预测的系统;

例如,现在该程序仅适用于:

1st  game   1 x 2 
2nd game   1 x 2 
3rd game   1 x 2 

等于(3 * 3 * 3 = 27 possible combinations)

但如果预测如下:

1st game   1 x
2nd game   1
3rd game   1 x 2

等于(2 * 1 * 3 = 6 possible combinations)

现在:第一场比赛1 x 2,第二场1 x 2,第三场1 x 2,等于(3 * 3 * 3 = 27种组合),但如果预测应该如下:第一场比赛1 x,第二场1,第三个x 2,等于(2 * 1 * 3 = 6个组合)应仅打印有效列。

提前感谢谁能帮我解决问题。

 Sub Combination_Prediction()

   Dim A As Integer
   Dim B As Integer
   Dim C As Integer
   Dim Col1Sviluppo As Integer
   Dim Row1Sviluppo As Integer

 Col1Sviluppo = 10
 Row1Sviluppo = 14

 For C = 3 To 5
     For B = 3 To 5
          For A = 3 To 5
               Contatore = Contatore + 1
               Col1Sviluppo = Col1Sviluppo + 1
               Cells(Row1Sviluppo + 1, Col1Sviluppo) = Cells(2, A)
               Cells(Row1Sviluppo + 2, Col1Sviluppo) = Cells(3, B)
               Cells(Row1Sviluppo + 3, Col1Sviluppo) = Cells(4, C)
               Cells(10, 10) = Contatore & " colonne elaborate"
         Next A
     Next B
    Next C
  End Sub 

1 个答案:

答案 0 :(得分:0)

免责声明:您的逻辑基于不可预测的假设。如果您下注真钱,请不要转发。这比你想象的要复杂得多。只有一种可靠的投注和赚钱方式(需要大量资金才能开始并且对博彩公司政策有正确和良好的理解)并且它被称为确定下注 s。但请,做不要进入它。

现在,回到原来的问题。

你可以让函数根据输入组合乘数

返回组合数

我们假设

combinations multipliers
1 - 1
2 - 1X
3 - 1X2

1代表本垒打或客场胜利,1组合

2代表主场胜利或平局,客场胜利或平局,2组合

3是默认值:win,draw,win

代码:

Sub Combination_Prediction()

    ' combinations multipliers
    ' 1 - 1
    ' 2 - 1X
    ' 3 - 1X2

    Range("A1") = Combination(3, 3, 3) ' 1x2, 1x2, 1x2
    Range("B2") = Combination(2, 1, 3) ' 1x, 1, 1x2

End Sub

Function Combination(c1 As Long, c2 As Long, c3 As Long) As Long

    Dim i As Long, j As Long, k As Long, combinationMultiplier As Long
    combinationMultiplier = 0

    For i = 1 To c1
        For j = 1 To c2
            For k = 1 To c3
                combinationMultiplier = combinationMultiplier + 1
            Next k
        Next j
    Next i

    Combination = combinationMultiplier
End Function

如果您运行此代码,则会在单元格A1编号27中看到正确和简化)计算可能赌注。

Combination()函数有3个参数,即3组合。

在第一个示例中,第一个输入为3, 3, 3,为

  

第一场比赛= 1x2

     

第二场比赛= 1x2

     

第3场比赛= 1x2

现在查看上面的 组合乘数

  

第一场比赛= 1x2 = 3

     

第二场比赛= 1x2 = 3

     

第3场比赛= 1x2 = 3

因此,您的3个参数是:3, 3, 3

您提供的第二个样本

  

第一场比赛= 1x = 2

     

第二场比赛= 1 = 1

     

第3场比赛= 1x2 = 3

因此Combination(2, 1, 3)会将6组合)返回到单元格A2

1, 2, 3的任意组合粘贴到组合函数中以获得结果。您可以将它们打印到单元格,也可以使用msgboxdebug.print进行测试。

我希望有帮助