✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Task 2Roman numerals are represented by the following symbols:
| I | 1 |
| V | 5 |
| X | 10 |
| L | 50 |
| C | 100 |
| D | 500 |
| M | 1000 |
Usually a smaller value follows a larger one: VIII = 8, XII = 12. However there are 6 cases where a smaller value is placed before a larger one - in that case it is subtracted:
IV = 4, IX = 9XL = 40, XC = 90CD = 400, CM = 900Implement a function that converts a Roman numeral string to a decimal integer.
The input string is guaranteed to be a valid Roman numeral in the range [1, 3999].
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!