[Community Puzzle] These Romans are crazy!

I am coding the algorithm in PHP and I am not passing 3rd validator. I have no clue what’s wrong with my code. I wonder if you can give me any intel to guess why it fails in that validator (it passes all tests and validators 1, 2 and 4).

Thanks in advance!

“Validator 3” is like Test “123 + 321 = 444” with a carry over

nothing new !

I have use my code in a sandbox with parameters “CXXIII” and “CCCXXI” and the answer provided is “CDXLIV”. The Test 3 is passed. The problem is the Validator 3. I don’t know why it fails when the Validator 3 checks it while Test 3 is passed.

I have tried my code in the sandbox running PHP 5.0.5, so I guess that’s not the problem.

Thanks for your answer. I can provide you a link to my code so you can test it yourself, but please check the Validator 3 is congruent with Test 3.

Try :

  • CCCXXXIII + CCXXII
  • CCXXII + CCXXII
  • CDXLIV + CXI
    or something like that …

Got:

  • DLV
  • CDXLIV
  • MDXV

I failed with a constant!!! The code was right, but the constant… A big shame on me. Thank you for your help and support.

Hello,

I fail at validator 4 when i submit my code but i don’t know why.
Can i have some help ?

Have you tried your code on all the numbers from 1 to 4999? It should not be too difficult to test all the major patterns out :wink:

@cilheo Did you figure out why you failed on Validator 4? I also failed it. I didn’t read the spec carefully (shame on me) and I only wrote my code to handle numbers up to 3999, the limit for Roman Numerals without the use of a vinculum according to EnglishHistory.net.