60 lines
1.6 KiB
Markdown
60 lines
1.6 KiB
Markdown
---
|
||
id: 5900f37d1000cf542c50fe90
|
||
challengeType: 5
|
||
title: 'Problem 17: Number letter counts'
|
||
videoUrl: ''
|
||
localeTitle: 问题17:数字字母计数
|
||
---
|
||
|
||
## Description
|
||
<section id="description">如果数字1到5用文字写出:一,二,三,四,五,则总共使用3 + 3 + 5 + 4 + 4 = 19个字母。如果从1到包含<code>limit</code>所有数字都用文字写出,那么会使用多少个字母? <b>注意:</b>不要计算空格或连字符。例如,342(三百四十二)包含23个字母,115(一百一十五)包含20个字母。在写出数字时使用“和”符合英国的用法。 </section>
|
||
|
||
## Instructions
|
||
<section id="instructions">
|
||
</section>
|
||
|
||
## Tests
|
||
<section id='tests'>
|
||
|
||
```yml
|
||
tests:
|
||
- text: <code>numberLetterCounts(5)</code>应返回19。
|
||
testString: 'assert.strictEqual(numberLetterCounts(5), 19, "<code>numberLetterCounts(5)</code> should return 19.");'
|
||
- text: <code>numberLetterCounts(150)</code>应该返回1903。
|
||
testString: 'assert.strictEqual(numberLetterCounts(150), 1903, "<code>numberLetterCounts(150)</code> should return 1903.");'
|
||
- text: <code>numberLetterCounts(1000)</code>应该返回21124。
|
||
testString: 'assert.strictEqual(numberLetterCounts(1000), 21124, "<code>numberLetterCounts(1000)</code> should return 21124.");'
|
||
|
||
```
|
||
|
||
</section>
|
||
|
||
## Challenge Seed
|
||
<section id='challengeSeed'>
|
||
|
||
<div id='js-seed'>
|
||
|
||
```js
|
||
function numberLetterCounts(limit) {
|
||
// Good luck!
|
||
return true;
|
||
}
|
||
|
||
numberLetterCounts(5);
|
||
|
||
```
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</section>
|
||
|
||
## Solution
|
||
<section id='solution'>
|
||
|
||
```js
|
||
// solution required
|
||
```
|
||
</section>
|