鱼C论坛

 找回密码
 立即注册
查看: 2030|回复: 1

题目121:考察彩色圆盘的游戏

[复制链接]
发表于 2016-8-22 22:41:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
Disc game prize fund

A bag contains one red disc and one blue disc. In a game of chance a player takes a disc at random and its colour is noted. After each turn the disc is returned to the bag, an extra red disc is added, and another disc is taken at random.

The player pays £1 to play and wins if they have taken more blue discs than red discs at the end of the game.

If the game is played for four turns, the probability of a player winning is exactly 11/120, and so the maximum prize fund the banker should allocate for winning in this game would be £10 before they would expect to incur a loss. Note that any payout will be a whole number of pounds and also includes the original £1 paid to play the game, so in the example given the player actually wins £9.

Find the maximum prize fund that should be allocated to a single game in which fifteen turns are played.


题目:

一个包内有一红色圆盘和一蓝色圆盘。游戏中,一个玩家随机拿出一个圆盘,并记录下颜色。每轮游戏结束后,圆盘都要放回包中,并且在包内再放入一红色圆盘,再随机抽取另一圆盘。

要玩儿这个游戏玩家每次需要付费 1 元,如果他们游戏结束时,抽到的蓝色圆盘数比红色圆盘数多的话,则算赢得游戏。

如果这个游戏每次玩四轮,那么玩家获胜的概率是 11/120,所以庄家应该设定的奖金最高应为 10 元,以避免亏损。

注意玩家的最终获利数目是整数,而且包括了起初下注的 1 元。所以,本例中,玩家最终获利 9 元。

请给出在一局 15 轮决胜的游戏中,庄家应设置的最高奖金。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2016-12-1 21:35:08 | 显示全部楼层
解答:
#coding:utf-8
import itertools as it
r = 15
p = list(range(2,r+2))
lose = int((r-1)/2)
t = 0
for l in range(lose+1):
    if l == 0:
        w = 1
        t += w
    else:
        fcom = it.combinations(p,l)
        for each in fcom:
            w = 1
            for e in each:
                w *= (e-1)
            t += w
tt = 1
for j in p:
    tt *= j
print (int(tt/t))
输出:
2269
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-12-22 21:37

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表