Roman conversion


Submit solution

Points: 45 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

題目說明

給定一羅馬符字串,請將其轉為阿拉伯數字並輸出

輸入限制 字串

羅馬符對照表

Symbol       Value
I             1
V             5
X             10
L             50
C             100
D             500
M             1000

其中I可在VX前,為49

X可在LC前,為4090

C可在DM前,為400900

輸入

字串

輸出

整數數字

範例輸入1

II

範例輸出1

2

範例輸入2

XXVII

範例輸出2

27

範例輸入3

XLV

範例輸出3

45

說明:由右至左計算。V=5,但X在L前面,所以XL是50-10=40,答:40+5=45


Comments

There are no comments at the moment.