freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-121-disc-game-prize...

56 lines
1.5 KiB
Markdown
Raw Normal View History

---
id: 5900f3e51000cf542c50fef8
challengeType: 5
title: 'Problem 121: Disc game prize fund'
videoUrl: ''
localeTitle: 问题121光盘游戏奖金
---
## Description
<section id="description">一个包包含一个红色圆盘和一个蓝色圆盘。在有机会的游戏中玩家随机拍摄光盘并记录其颜色。每次转动后光盘返回到包中添加一个额外的红色光盘随机拍摄另一张光盘。如果玩家在游戏结束时拍摄的红色光盘多于红色光盘则玩家可以支付1英镑玩游戏并获胜。如果游戏进行了四轮比赛那么玩家获胜的概率恰好是11/120因此银行家在这场比赛中应该分配的最高奖金将是10英镑然后才会产生损失。请注意任何支付都将是一个整数磅并且还包括为玩游戏而支付的原始£1因此在给出的示例中玩家实际上赢得了9英镑。找到应该分配给单个游戏的最大奖金其中玩15个回合。 </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler121()</code>应返回2269。
testString: 'assert.strictEqual(euler121(), 2269, "<code>euler121()</code> should return 2269.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler121() {
// Good luck!
return true;
}
euler121();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>