|Online Judge||Problem Set||Authors||Online Contests||User|
``The system of Roman numerals is a numeral system originating from ancient Rome, and was adapted from Etruscan numerals. The system used in classical antiquity was slightly modified in the Middle Ages to produce the system we use today. It is based on certain letters which are given values as numerals." (From wikipedia.org)
Since ACM is where innovation starts, a new numeral system, called Nuevo-Romano, is derived from the Roman numerals with one slight modification. The basic set of Roman Numeral systems are:
Nuevo-Romano extends it by adding `O' or `o' to mean multiplied by one thousand. However, the new numeral is only applied to numerals greater than 3 or III or iii, e.g.
The same rules for multiple symbol combinations to produce numbers between these values are applied.
The task is to determine the sum of two Nuevo-Romano numbers and output both the Nuevo-Romano number and the Latin alphabet-based Arabic number.
Each line in the input consists of two Nuevo-Romano numbers separated by a `+' sign. The input is in mixed case. If the given Nuevo-Romano number is not a valid one, print ``INVALID" in the line.
No strings presumed to be a Nuevo-Romano number will exceed 100 in length.
The sum expressed as a Nuevo-Romano number in uppercase and its Arabic number form separated by an `=' sign.
XLII+CC MODccXLIX+cxi COD+IC LXIIOCCLXXXVIII+IVOCXX
CCXLII=242 MODCCCLX=1000860 INVALID LXVIOCDVIII=66408
1. multiple 'O' is allowed
2. 'O' followed by 'M' is invalid
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator