Format integers Sergey Svistunov

Compute a checksum over the decimal representations of binary integers as fast as possible.

Input: 250 000 000 uint32 values in little-endian binary on STDIN (4 bytes each).

Output: A uint64 checksum computed as:

CRC = sum of number_crc(n) for each n

where number_crc(n) converts n to its decimal string and sums ascii(digit) * position over each digit (0-indexed from the left).

Example: For n = 42, the decimal string is "42", so number_crc(42) = ascii('4') * 0 + ascii('2') * 1 = 52 * 0 + 50 * 1 = 50.

Back to listMay 3, 2021 12:46Yurkov AlekseyYurkov AlekseyError
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 3, 2021 12:4600000Wrong answer: expected "530158840308 ", got "113310 "
2May 3, 2021 12:4600000Wrong answer: expected "530155079778 ", got "331113 "
3May 3, 2021 12:4700000Wrong answer: expected "530157011490 ", got "506071 "
4May 3, 2021 12:4800000Wrong answer: expected "530158647508 ", got "456403 "
5May 3, 2021 14:4600000Wrong answer: expected "530156755625 ", got "659565 "
6May 3, 2021 14:4600000Wrong answer: expected "530158005687 ", got "706868 "
7May 3, 2021 14:4700000Wrong answer: expected "530156326387 ", got "1849919 "
8May 3, 2021 16:5500000Wrong answer: expected "530157737422 ", got "143397 "
9May 17, 2021 23:2300000Wrong answer: expected "530157472763 ", got "500029 "