May 2009 - May 2017 论坛八周年-你的足迹,我的骄傲



查看: 788|回复: 0


[复制链接] |试试Instant~ |关注本帖
haifengc 发表于 2015-10-21 10:29:49 | 显示全部楼层 |阅读模式

2015(10-12月) 码农类 博士 全职@Square - 网上海投 - 技术电面 |Failfresh grad应届毕业生


您需要 登录 才可以下载或查看,没有帐号?获取更多干活,快来注册

Let's implement the Monty Hall problem from Let's Make a Deal, with an arbitrary number of doors.  In this game show, there are n doors – we'll take this as a parameter.  Behind one of them is a fabulous prize (a car), and behind the others are worthless items (goats).  To start, the player will pick one of the doors – this is our second parameter. This door is not opened. Then the host will reveal a goat behind another door, continuing until there are only two doors still closed: one the contestant first chose and one other.  The host only reveals goats, never reveals the door the player has chosen, and stops when there are only two doors left (the one the player has chosen and one other).  Then the host offers the player a choice: either keep their current door or switch to the other closed door – this choice is our last parameter.  Then the host reveals what's behind the chosen door, and the player either wins a fabulous prize or a goat.  We'll start with simulating a single game, taking an arbitrary number of doors.






一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明 ( 沪ICP备11015994号 )

custom counter

GMT+8, 2017-5-26 15:57

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

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