freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-40-champernownes-co...

60 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f3941000cf542c50fea7
challengeType: 5
videoUrl: ''
title: 问题40Champernowne的常数
---
## Description
<section id="description">通过连接正整数创建无理小数: <span style="display: block; text-align: center;">0.12345678910 <b style="color: red;">1</b> 112131415161718192021 ...</span>可以看出小数部分的<sup></sup> 12位是1.如果<i>d <sub>n</sub></i>代表小数部分的<sup></sup> <i>n</i>位,找到值以下表达式。 <span style="display: block; text-align: center;">d <sub>1</sub> ×d <sub>10</sub> ×d <sub>100</sub> ×d <sub>1000</sub> ×d <sub>10000</sub> ×d <sub>100000</sub> ×d <sub>1000000</sub></span> </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>champernownesConstant(100)</code>应该返回5。
testString: assert.strictEqual(champernownesConstant(100), 5);
- text: <code>champernownesConstant(1000)</code>应该返回15。
testString: assert.strictEqual(champernownesConstant(1000), 15);
- text: <code>champernownesConstant(1000000)</code>应该返回210。
testString: assert.strictEqual(champernownesConstant(1000000), 210);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function champernownesConstant(n) {
// Good luck!
return true;
}
champernownesConstant(100);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>