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 10:11Yurkov 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 10:1100000Wrong answer: expected: 1010006561 got: 11 3 2 12 2 4 9 14 8 5 11 6 2 6 5 4 7 5 3 10 11 10 9 13 2 14 6 14 10 4 8 5 2 9 10 14 11 2 13 10 9 7 14 5 14 15 10 7 2 11 1 6 13 3 8 6 7 8 12 11 9 11 11 13 6 12 14 14 15 1 9 8 2 8 8 15 9 3 15 10 3 3 2 5 10 12 5 ...