[Community Puzzle] These Romans are crazy!

https://www.codingame.com/training/medium/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.

3 posts were merged into an existing topic: These Romans are crazy!

Error
1 ≤ Rom1 ≤ 4999
1 ≤ Rom2 ≤ 4999
1 ≤ Rom1 + Rom2 ≤ 4999

Maximum for Latin characters ≤ 3999

MMMM is a error, but is works

No problem with MMMM in french wiki :

1 Like

Sorry, I don’t know Russian (even if I know a bit its alphabet).

How I can find some specific about Validators, I don’t get it, one of them don’t pass.

By the rule set provided “IIVX” would be equivalent to 13, however the test case provides “XIII” which also follows the rules. Are there additional rules to roman numerals that haven’t been provided?
Thanks!

“The character I just before an V or X has a value of -1 (example IX equals 9)”
only possible with one caractere I, not two …

Additional rules : bigger to the left, smaller to the right…

They are similar to the tests but only similar.

Ah ok, thank you!

I got 3/4 Validators correct. It would help to know what is being asked for in Validator 4. Thank you.

“M has a value of 1000 (maximum 4 in a row)”…

1 Like

no further comments

I have the same problem. Validator #4 does not pass. No idea why.

Fixed. I had to allow MMMM.

Oh man, haven’t thought about that. Thanks for that tip.