freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-89-roman-numerals.md

22 lines
1.0 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: 5900f3c51000cf542c50fed7
title: 问题89罗马数字
challengeType: 5
videoUrl: ''
---
# --description--
对于以罗马数字书写的数字被认为有效必须遵循基本规则。尽管规则允许以不止一种方式表达某些数字但始终存在编写特定数字的“最佳”方式。例如似乎至少有六种方式编写十六号IIIIIIIIIIIIIII VIIIIIIIIII VVIIIIII XIIIIII VVVI XVI但是根据规则只有XIIIIII和XVI是有效的最后一个例子被认为是最有效的因为它使用最少数量的数字。 11K文本文件roman.txt右键单击和'Save Link / Target As ...')包含一千个用有效但不一定是最小的罗马数字写的数字;请参阅关于...罗马数字,了解此问题的明确规则。通过以最小的形式编写每个字符来查找保存的字符数。注意:您可以假设文件中的所有罗马数字包含不超过四个连续的相同单位。
# --hints--
`euler89()`应该返回743。
```js
assert.strictEqual(euler89(), 743);
```
# --solutions--