简体   繁体   English

通过skiena理解乐透程序逻辑

[英]understanding lotto program logic by skiena

I am reading article from following location. 我正在从以下位置阅读文章。 Here is text snippet form document. 这是文本片段表单文档。

Link 链接

The problem of finding a minimum set of tickets that will guarantee a win is not a trivial one. 找到一套能保证获胜的最低票数并不是一件轻而易举的事。 Given that P out of R outcomes will be from the fortune-teller set, it is not difficult to see that there are NCP = (N/P!)/(NP)! 鉴于R中的P个结果将来自算命先生集,不难看出有NCP =(N/ P!)/(NP)! possible P-subsets from the fortune-teller set that can occur in the winning ticket. 算命先生集中可能出现的P-子集可能出现在中奖票中。 If we were to pick all P-subsets from the fortune-teller set W times and fill in the remaining RP slots arbitrarily, the set of tickets obtained will have at least W occurrences of each P-subset and guarantee us W wins. 如果我们从算命者中选择所有P子集W次并且任意填写剩余的RP时隙,则获得的票组将至少具有每个P子集的W次并且保证我们W获胜。 However, such a set need not be a minimal one and in most cases is not. 然而,这样的集合不需要是最小的集合,并且在大多数情况下不是。

We know from the fortune-teller's promise that one of the P-subsets will occur in the winning ticket. 我们从算命先生的承诺中知道其中一个P子集将出现在中奖票中。 It is possible for two P-subsets to differ by less than J numbers. 两个P子集的差异可能小于J个数。 When such a situation arises, the subsets are said to overlap or cover one another with respect to the shared J numbers and only one of the P-subsets must be in a purchased ticket. 当出现这种情况时,据说子集相对于共享的J号重叠或相互覆盖,并且只有一个P子集必须在购买的票中。 This phenomenon is best illustrated using an example. 使用示例可以最好地说明这种现象。 Suppose we are playing the PICK-4 Lotto and require one 2/4 win. 假设我们正在玩PICK-4 Lotto并需要一次2/4的胜利。 Hence R=4, J=2 and W=1. 因此R = 4,J = 2且W = 1。 Furthermore let's assume that the fortune-teller predicts 3 numbers from a set of 5 numbers ( ie P=3 and N=5 ). 此外,我们假设算命先生从一组5个数字中预测3个数字(即P = 3和N = 5)。 If all P-subsets were taken from the fortune-teller set and arbitrarily filled to complete the tickets, we would have a set of ten tickets that guarantees one 2/4 win ( See Figure 1 ). 如果所有P-subsets都是从算命套装中取出并任意填充以完成门票,那么我们将有一套十张门票,保证一次2/4获胜(见图1)。 However, it is also possible to exclude some tickets from this set because of several two-number overlaps. 但是,由于有两个数字重叠,也可以从该集合中排除某些票证。 For instance the subset {3, 4, 5} is different than {1, 3, 5} by only one number and it will be wasteful to use both of these in purchased tickets. 例如,子集{3,4,5}与{1,3,5}仅相差一个数字,并且在购买的票证中使用这两者都是浪费的。 We might think that not including {3, 4, 5} will permit the possibility of losing, but that is not the case since if {3, 4, 5}occurs we will have '3' and '5' in {1, 3, 5}that we bought to claim the prize! 我们可能认为不包括{3,4,5}将允许丢失的可能性,但事实并非如此,因为如果{3,4,5}发生,我们在{1中将有'3'和'5', 3,5}我们买来要领奖! Similarly there can be many more redundant P-subsets. 类似地,可以存在更多冗余P子集。 An optimal solution is shown in Figure 2. Our lottery problem is that of finding the smallest set of P-subsets from the fortune-teller set that guarantees the specified number of wins by keeping the number of overlaps to a minimum. 最佳解决方案如图2所示。我们的彩票问题是从算命先生集中找到最小的P子集,通过将重叠次数保持在最小值来保证指定的获胜次数。 This set of P-subsets defines the winning set regardless of what numbers are used to complete the R slots on the ticket. 这组P子集定义了获胜集,无论用什么数字来完成票证上的R插槽。

My question are followiong 我的问题是跟随

  1. As author metioned "If all P-subsets were taken from the fortune-teller set and arbitrarily filled to complete the tickets, we would have a set of ten tickets" As in article table is missing can any one help me here what are the 10 tickets? 正如作者所提到的“如果所有P-subsets都是从算命套装中取出并随意填写以完成门票,我们就会有一套十张票”因为在文章表中缺少任何人可以帮助我这里有什么10票?

  2. In above example if 1 and 3 occurs and if we didn't select {1, 3, 5} how can we win here? 在上面的例子中,如果1和3发生,如果我们没有选择{1,3,5}我们怎么能在这里获胜?

  3. Can anyone come up with fig 2 which is missing in article? 任何人都可以提出文章中缺少的图2吗?

thank! 谢谢!

  1. Here is an inefficent list of 10 tickets 这是一张10张票的无效列表

     {1, 2, 3, 6} {1, 2, 4, 6} {1, 2, 5, 6} {1, 3, 4, 6} {1, 3, 5, 6} {1, 4, 5, 6} {2, 3, 4, 6} {2, 3, 5, 6} {2, 4, 5, 6} {3, 4, 5, 6} 
  2. Mu. 亩。 To win we need to match 2 out of 4. So it isn't the case that 1 and 3 occurs, it is the case that a specific set of 3 occurs and we only need to match 2 of them. 为了获胜,我们需要匹配4中的2个。因此不是1和3发生的情况,而是出现了一组特定的3并且我们只需要匹配其中的2个。

  3. I think this is optimal. 我认为这是最佳的。

     {1, 2, 3, 4} 

But I'm not entirely positive that I can pick 4. If I am only allowed to pick 3 per ticket then an optimal set would be: 但我并不完全肯定我可以选择4.如果我只允许每张票选3张,那么最佳套装将是:

    {1, 2, 3}
    {2, 3, 4}

The two tickets are: 这两张票是:

{ 1, 3, 5, X } {1,3,5,X}

{ 2, 4, 5, X } {2,4,5,X}

where X is an arbitrarily chosen number which does not affect the solution. 其中X是任意选择的数字,不影响解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM