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 listDec 26, 2024 02:10Joad NacerJoad NacerScore: 178,589Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 26, 2024 02:10178,517896,106,224873,733,000999,0002,424,832
2Dec 26, 2024 02:10178,564894,528,045874,965,00002,269,184
3Dec 26, 2024 02:10178,577907,987,300875,028,00002,531,328
4Dec 26, 2024 02:10178,586899,710,364874,069,0001,000,0002,510,848
5Dec 26, 2024 02:10178,589905,732,945874,084,0001,000,0002,428,928
6Dec 26, 2024 02:10178,593907,671,616875,106,00002,433,024
7Dec 26, 2024 02:10178,594900,836,219875,112,00002,437,120
8Dec 26, 2024 02:10178,636904,950,099873,319,0001,998,0002,269,184
9Dec 26, 2024 02:10179,050906,458,176876,348,000999,0002,531,328