[Community Puzzle] Nicholas Breakspeare and Hugh of Evesham


Send your feedback or ask for help here!

Created by @anon91538998,validated by @fgsdt,@LifeStream and @VirtualAtom.
If you have any issues, feel free to ping them.

Cardinal definitions should be part of the problem statement since pretty much all non-English speakers need to check them out somewhere.

Here’s one https://grammartop.com/cardinal-and-ordinal-numbers/


Test case 6 breaks the provided Dart input parser. Use double and double.parse() instead of int to make it work

1 Like

PHP NumberFormatter class doesn’t work with case 4 and 6 either. 32-bit versions of PHP will not handle integers bigger than 2,147,483,647 (2 billion and change). 64-bit versions will handle up to like 9 quintillion or something.

I switched everything to BigInt and that worked as well.

CG runs 64-bit PHP so there is no problem: all test cases within 64 bits.

Using NumberFormatter::SPELLOUT is a clever idea, but maybe it is for the better that the expected format is slightly different. The ability to use this would render the puzzle to a single library function call.

My solution became long and quite not elegant.
I am wondering if some Haskell magicians will come up with a clever one-liner solution… :slight_smile:

Nice puzzle title! :slight_smile:

No, they are not. The smallest is -2⁶⁴ in testcase 6. Even when I remove the minus and parse it as an unsigned long, I get this:

Unhandled exception. System.OverflowException: Value was either too large or too small for a UInt64.

I submitted anyways and passed the validators. Obviously you don’t even have to parse the input as a number, so I modified the stub of this contribution to read a string instead of the 32bit int it was before. Now the default code doesn’t crash anymore at least.
I also question the moderation process here. someone even commented “I had fun trying to handle -2^64 in C++” in the approval message, another user mentioned the overflow caused by the default code too.


You are right, my short term memory is <1 bit. By the time I posted in the forum, I already forgot that I parsed and processed the input as string 1 hour earlier, that’s why I did not encounter any overflow.

I passed all 7 tests but when I submit it I have only 85%. The validator “Other powers of 10” is not passed.
I’ve checked it manually and every power of 10 (from 10 to even one sextillion) works… What can be wrong?

Did you test it locally or in CodinGame platform? Maybe there’s a timeout issue. You may test it as a custom case inside CodinGame platform and see what the error message is, if any.