###NB: work in progress
NB: work in progress
Convert MADBACE to DECIMAL
MADBACE is a mixed Roman-hexdecimal system. Hexadecimal digits (0-F) take their normal positional values, while Roman numerals (IVXLCDM) have their normal values (1 5 10 50 100 500 1000). The main parts of the challenge is to determine when to subtract and when C and D are Roman versus hexadecimal.
###Rules
Rules
C
andD
will be Roman if possible.There can never be more than one subtractive symbol to the left of any symbol.
A subtractive symbol must be less than half the symbol it subtracts from
###Examples
Examples
CM
→ 900
MC
→ 1100
MD
→ 1500
DM
→ 792
1000-13×161
LD
→ 450
CD
→ 400
XD
→ 40
ID
→ 49
13×160-1
3C
→ 52
100-3×161
4C
→ 76
4×161+12×160
MADBACE
→ 701590
(10×165-1000)+(11×163-500)+10×162+100+14×160
DECIMAL
→ 233571513
13×166+14×165+12×164+(1000-1)+10×161+50