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 19, 2021 21:40Andrey TsvetkovAndrey TsvetkovScore: 1,113,883Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 19, 2021 21:401,049,8615,200,956,6445,144,316,57402,207,744
2May 19, 2021 21:401,049,8815,210,707,0285,144,417,26402,215,936
3May 19, 2021 21:401,050,0615,213,969,5075,145,299,24302,203,648
4May 19, 2021 21:401,113,8115,511,907,3585,457,674,63002,203,648
5May 19, 2021 21:401,113,8835,510,123,9095,458,028,77402,203,648
6May 19, 2021 21:401,113,8875,517,813,2625,458,046,83102,203,648
7May 19, 2021 21:401,113,9535,520,140,7735,458,370,63402,203,648
8May 19, 2021 21:401,114,0795,521,382,7385,458,985,87702,220,032
9May 19, 2021 21:401,114,3315,517,238,4885,460,221,59002,220,032