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 13, 2021 12:05Sergey StreminSergey StreminError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 13, 2021 12:0500000Wrong answer: expected: 1009883998 got: 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 48 11 49 12 50 13 51 14 52 15 53 16 54 17 55 18 56 19 57 20 48 21 49 22 50 23 51 24 52 25 53 26 54 27 55 28 56 29 57 30 48 31 49 32 50 33 51 34 52 35 53 36 54 37 55 38...