I know this Thread about problem 759 is very old ( year 2003 ) but
as I have troubles with problem 759 now, I am going to make a post
in the this same thread.
I use the standard algorithm which is described above ( by Yarin ).
Firstly, generate the roman representation of all numbers N which
are in the range [1,3999] and put them in a hashtable let's say. This
hashtable maps
.
Secondly, read the input line by line and using the line read as
a key check if there is an element in the hashtable under
that key. If there is such element then print it, otherwise print that
the roman number given in the input is not valid.
So ...
I have this quesiton - are we sure that on each line
of the Judge Input there is either an invalid Roman Number
or a valid Roman Number representing an Arabic Integer
in the range [1,...,3999].
If the answer to this question is YES then I have more
serious troubles. I probably have a BUG and generate wrong
Roman Representation for some integers 1<=N<=3999.
So my precalculated hashtable contains invalid values which
results in a WA of course.
If the answer is NO then ... What is the range ? Can we have
as input some Roman Number whose Arabic Integer
represantation N is such that N < 1 or N >= 4000 ?!
Yes, I forgot to mention that currently I have WA on this problem.