ROMAN008 - ROMAN NUMERALS

no tags 

You are given two numbers in Roman system (modern Roman Numerals) and an operator. Output is the result in Roman system.

Input

You are given two space separated numbers in roman system and after space an operator on the same line. Operator can be +, -, /, *, %.

Numbers a, b: 1 <= a, b<5000

eg: 4000=MMMM, for numbers >=4000, you should use MMMM.....

for others as per definition.

Input consists of 5 testcases.

Output

Output is the result < 5000 of performing the operation. Print on a separate line

Example

Input:
LX XV +
X V *

Output:
LXXV
L

hide comments
:D: 2012-09-15 16:00:47

I think it's good enough for an easy classical. Also thanks for the link Francky. It should be added the the problem description.

numerix: 2012-09-15 16:00:47

60 + 15 = 75

accept: 2012-09-15 16:00:47

thanx

Last edit: 2012-08-18 22:04:22
Francky: 2012-09-15 16:00:47

I think there's no blank line in the input, and we do not have to put some in the output. I did like that, and AC.

mehmetin: 2012-09-15 16:00:47

Is there a blank line between each output? (but not after the last)?

Francky: 2012-09-15 16:00:47

I use those rules to get AC.
http://projecteuler.net/about=roman_numerals

numerix: 2012-09-15 16:00:47

@problemsetter: There is definitely not one standard way. Wikipedia says: "There has never been a universally accepted set of rules for Roman numerals. Because of this lack of standardization, there may be multiple ways of representing the same number in Roman numerals. For example, the United States National Institute of Standards and Technology could find no authority that could describe if the year 1999 should be written as MDCCCCLXXXXVIIII, MCMXCIX, or MIM."
Anyway: Problem should be moved to tutorial.

Last edit: 2012-08-17 18:47:29
himanshu jain: 2012-09-15 16:00:47

language restriction removed

Francky: 2012-09-15 16:00:47

I don't understand time limit and language restrictions. Please explain. I find it very curious !!!
EDIT : Thanks for having open to more languages.
And like numerix, I think this problem belongs to tutorial.

Last edit: 2012-08-17 18:52:29
himanshu jain: 2012-09-15 16:00:47

there are not multiple ways in MODERN numeral system


Added by:himanshu jain
Date:2012-08-17
Time limit:0.100s
Source limit:2000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: FSHARP JS-RHINO
Resource:own problem