Skip to content
/ romans Public

Solution to puzzle challenge from CodinGame "These Romans are crazy!"

Notifications You must be signed in to change notification settings

albaad/romans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Project title: These Romans are crazy!



Source: Puzzle challenge from CodinGame: 

https://www.codingame.com/ide/40455539dfd3fe6cb8e34d968c27b6fea58f136

Description:


You are given 2 expressions representing 2 numbers written in roman numerals.
You have to provide the result of the sum of these 2 numbers, also in roman numerals.

I has a value of 1 (maximum 3 in a row)
V has a value of 5 (maximum 1 in a row)
X has a value of 10 (maximum 3 in a row)
L has a value of 50 (maximum 1 in a row)
C has a value of 100 (maximum 3 in a row)
D has a value of 500 (maximum 1 in a row)
M has a value of 1000 (maximum 4 in a row)

The character I just before an V or X has a value of -1 (example IX equals 9)
The character X just before an L or C has a value of -10 (example XL equals 40)
The character C just before an D or M has a value of -100 (example CM equals 900)

Input
Line 1 : Rom1 (the 1st number in roman numerals)
Line 2 : Rom2 (the 2nd number in roman numerals)

Output
The result of Rom1 + Rom2 written in roman numerals

Constraints
1 = Rom1 = 4999
1 = Rom2 = 4999
1 = Rom1 + Rom2 = 4999

Example

Input
VI
VII

Output
XIII

About

Solution to puzzle challenge from CodinGame "These Romans are crazy!"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages