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 22, 2021 18:42Andrey TsvetkovAndrey TsvetkovScore: 1,203,429Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 22, 2021 18:421,137,2175,641,986,5695,572,362,84902,215,936
2May 22, 2021 18:421,137,2955,631,863,4405,572,745,80702,215,936
3May 22, 2021 18:421,137,3055,626,248,8045,572,793,52302,203,648
4May 22, 2021 18:421,203,4295,953,126,6465,896,803,85502,215,936
5May 22, 2021 18:421,203,5585,958,972,0435,897,435,74202,199,552
6May 22, 2021 18:421,203,5725,976,909,4905,897,500,95302,211,840