Challenge #5: Roman Numerals Additions!

Please use to write your code if you are using Lua. Any other language is perfectly fine, as long as the outputs match.

Table of Content

Part: Name
Part A Last Question's Editorial
Part B The Judge Rules
Part C The Problem Statement
Part D Input Specifications
Part E Output Specifications
Part F Sample Test cases
Part G Other Information

Part A: Last Question's Editorial

I have moved editorials, and all solutions into a github repository which you can access it here.

I am still writing out the editorial so it might take a little bit of time. Thanks for the patience!

Part B: Judge Rules

Name Property
Time Limit < 5 seconds
Memory Limit < 64 MB
Problem Type String Algorithms

You do not need to worry about time limit or memory limit unless I explicitly ask you to do so. In this case, I am not asking, so you do not need to worry about it.

Part C: The Problem Statement

Jiramide was very sick one day. While he was in his bed, he saw an old paper fall off his cabinet. The paper had a list of Roman Numerals. Intrigued by this, he decided to create a simple program just to spend some time. He decides that he wants to create a simple Roman Numeral Calculator, with only addition for now, he thought.

The very next day, he boasts about how amazing his program was. Feeling very jealous, you decide to create the program as well. You quickly google the Basic Roman Numerals and found this chart

Arabic Numbers Roman Numeral
1 I
5 V
10 X
50 L
100 C
500 D
1000 M

Because you don't want to work too hard, you set anything above 1000 as an illegal number. If you deem that a number is illegal, you are to output contra legem

Part D : Input Specifications

  • The first line will contain integer n which can be at most from 1 - 10.
  • For the next n lines, Roman Numeral Expression is inputed.

Part E: Output Specifications

  • Output the expression first then the result of the expression.

Part F: Sample Test cases

// Sample Input 1
// Sample Output 1
M+I=contra legem

Part G: Other Information

This shouldn't be too difficult to implement.

Once you have finished writing the code and you want to submit your answer, please send it to me on discord. My Discord username and id is Zafirua#8828. I don't want you posting it in the forums because I want everyone to try on their own.

Good luck to everybody!!!