56 lines
1.5 KiB
Markdown
56 lines
1.5 KiB
Markdown
|
---
|
|||
|
id: 5900f3c51000cf542c50fed7
|
|||
|
challengeType: 5
|
|||
|
title: 'Problem 89: Roman numerals'
|
|||
|
videoUrl: ''
|
|||
|
localeTitle: 问题89:罗马数字
|
|||
|
---
|
|||
|
|
|||
|
## Description
|
|||
|
<section id="description">对于以罗马数字书写的数字被认为有效,必须遵循基本规则。尽管规则允许以不止一种方式表达某些数字,但始终存在编写特定数字的“最佳”方式。例如,似乎至少有六种方式编写十六号:IIIIIIIIIIIIIII VIIIIIIIIII VVIIIIII XIIIIII VVVI XVI但是,根据规则,只有XIIIIII和XVI是有效的,最后一个例子被认为是最有效的,因为它使用最少数量的数字。 11K文本文件roman.txt(右键单击和'Save Link / Target As ...')包含一千个用有效但不一定是最小的罗马数字写的数字;请参阅关于...罗马数字,了解此问题的明确规则。通过以最小的形式编写每个字符来查找保存的字符数。注意:您可以假设文件中的所有罗马数字包含不超过四个连续的相同单位。 </section>
|
|||
|
|
|||
|
## Instructions
|
|||
|
<section id="instructions">
|
|||
|
</section>
|
|||
|
|
|||
|
## Tests
|
|||
|
<section id='tests'>
|
|||
|
|
|||
|
```yml
|
|||
|
tests:
|
|||
|
- text: <code>euler89()</code>应该返回743。
|
|||
|
testString: 'assert.strictEqual(euler89(), 743, "<code>euler89()</code> should return 743.");'
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
</section>
|
|||
|
|
|||
|
## Challenge Seed
|
|||
|
<section id='challengeSeed'>
|
|||
|
|
|||
|
<div id='js-seed'>
|
|||
|
|
|||
|
```js
|
|||
|
function euler89() {
|
|||
|
// Good luck!
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
euler89();
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</section>
|
|||
|
|
|||
|
## Solution
|
|||
|
<section id='solution'>
|
|||
|
|
|||
|
```js
|
|||
|
// solution required
|
|||
|
```
|
|||
|
</section>
|