Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

ROMANCAL - Roman calculator

Dla liczb a i b w rzymskim systemie liczbowym oblicz ich sumę, różnicę, iloczyn, iloraz lub resztę z dzielenia w zależności od znaku c.

Input

W pierwszej linii znajduje się liczba testów t (t<101).

W każdej z t linii znajduje się string a (I<=a<=V*M), znak c ('+', '-', '*', ':' lub '%') i string b (I<=b<=V*M).

Output

Dla każdego testu wypisz wynik odpowiedniego działania w systemie rzymskim lub ERROR jeśli wynik wynosi 0. Jeśli natomiast wynik jest ujemny wypisz '-' na początku wyniku. Wynik będzie liczbą całkowitą.

Przykład

Wejście:
6
II + III
II - III
II * III
VI : III
V % III
I - I
Wyjście:
V
-I
VI
II
II
ERROR


Added by:Piotr Kąkol
Date:2009-12-23
Time limit:2.484s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC SCM qobi VB.NET
Resource:Roman numerals

hide comments
2011-02-08 19:04:50 Piotr KÄ…kol
9000.
2011-02-07 04:08:12 Hallvard Norheim Bø
What is the upper limit on the output string length?
2010-09-01 09:18:44 Piotr Fusik
Thank you.
2010-08-31 19:45:06 Piotr KÄ…kol
For example:
MCDLXXIV % LVII
:-)
2010-08-31 19:10:07 Piotr Fusik
Okay, that was Perl 5.12 vs 5.10 incompatibility. How about 3984519 ?
2010-08-30 16:53:29 Piotr KÄ…kol
Always, unfortunately. It always print ERROR. Here are real errors from Your program:
Number found where operator expected at (eval 1) line 1, near "0 0"
(Missing operator before 0?)
Number found where operator expected at (eval 2) line 1, near "00 00"
(Missing operator before 00?)
Number found where operator expected at (eval 3) line 1, near "000 000"
(Missing operator before 000?)
Number found where operator expected at (eval 4) line 1, near "0000 0000"
(Missing operator before 0000?)
etc.

Weird that You got WA, not NZEC or SIGSEGV.

Last edit: 2010-08-30 16:54:23
2010-08-30 14:44:18 Piotr Fusik
When does my solution 3979876 give wrong answer?
2010-02-19 22:35:31 Piotr KÄ…kol
There are only letters: I,V,X,L,C,D,M. Then you print as many M's as you need.
So for example M*M is 1000*1000 so 1000 of M's and MMMM + MMMM is MMMMMMMM.
Good luck. ;-)

Last edit: 2010-02-19 22:37:10
2010-02-19 14:50:05 Alessandro Ferreira - UFMS
How values greater than 3999 are represented in input?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.