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 listNov 16, 2024 16:40Dan StolyarovDan StolyarovScore: 2,158,966Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 16, 2024 16:402,158,57710,615,091,71810,466,078,000110,947,0002,289,664
2Nov 16, 2024 16:402,158,58110,613,011,87310,464,101,000112,947,0002,281,472
3Nov 16, 2024 16:402,158,60910,612,854,97410,461,249,000115,936,0002,473,984
4Nov 16, 2024 16:402,158,67310,611,450,28410,466,569,000110,931,0002,281,472
5Nov 16, 2024 16:402,158,96610,611,887,48210,462,999,000115,933,0002,281,472
6Nov 16, 2024 16:402,158,99210,615,301,00210,473,111,000105,950,0002,281,472
7Nov 16, 2024 16:402,159,50610,608,646,27710,459,643,000121,937,0002,281,472
8Nov 16, 2024 16:402,159,50610,614,312,47110,478,643,000102,937,0002,351,104
9Nov 16, 2024 16:402,159,94610,616,715,36710,469,802,000113,932,0002,277,376