Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-285-pythagorean-odds.md
Oliver Eyton-Williams dec409a4bd fix: s/localeTitle/title/g
2020-10-06 23:10:08 +05:30

67 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f48a1000cf542c50ff9c
challengeType: 5
videoUrl: ''
title: 问题285毕达哥拉斯赔率
---
## Description
<section id="description">
Albert选择一个正整数k然后在区间[0,1]中以均匀分布随机选择两个实数ab。
然后计算和k·a + 12 +k·b + 12的平方根并四舍五入为最接近的整数。 如果结果等于k他得分为k分 否则他什么也没得分。
例如如果k 6a 0.2b 0.85k·a + 12 +k·b + 12 42.05。
42.05的平方根是6.484 ...四舍五入到最接近的整数后它变为6。
这等于k因此他得到6分。
可以看出如果他以k = 1k = 2...k = 10进行10圈则他的总得分的期望值四舍五入到小数点后五位。
如果他以k = 1k = 2k = 3...k = 105进行105转他的总得分的期望值是多少四舍五入到小数点后五位
</section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler285()</code>应该返回157055.80999。
testString: assert.strictEqual(euler285(), 157055.80999);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler285() {
// Good luck!
return true;
}
euler285();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>