Roman Numerals#4103

Roman Numerals

1 saniye
64 megabayt
Çok kolay

In your new project, you need to work with Roman numerals and convert them into decimal numbers.

The Roman numeral system uses the following symbols:

I = 1

V = 5

X = 10

L = 50

C = 100

D = 500

M = 1000

Roman numerals are formed by combining these symbols. When a larger or equal symbol precedes a smaller one, their values are added. If a smaller symbol comes before a larger one, the smaller value is subtracted from the larger.

Giriş

The first line contains the integer (1 \leq N \leq 100) — the number of Roman numerals to convert. The next lines each contain a Roman numeral.

Çıktı

Output decimal numbers, each representing the conversion of the corresponding Roman numeral from the input. The decimal numbers should be in the same order as their respective Roman numerals. It is guaranteed that each converted number will be within the range .

Örnekler

Örnek 1

Loading
Loading