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 listOct 3, 2022 05:01Bernard TeoBernard TeoScore: 60,278Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 3, 2022 05:0160,233315,167,550295,141,00002,281,472
2Oct 3, 2022 05:0160,260317,142,716294,275,0001,000,0002,510,848
3Oct 3, 2022 05:0160,262322,679,771294,286,0001,000,0002,281,472
4Oct 3, 2022 05:0160,264317,152,576294,292,0001,000,0002,281,472
5Oct 3, 2022 05:0160,265324,099,990295,300,00002,281,472
6Oct 3, 2022 05:0160,271315,036,157294,325,0001,001,0002,281,472
7Oct 3, 2022 05:0160,278320,959,327294,361,0001,001,0002,400,256
8Oct 3, 2022 05:0160,283320,355,186295,386,00002,387,968
9Oct 3, 2022 05:0160,286330,307,501295,402,00002,404,352
10Oct 3, 2022 05:0160,567358,289,375296,777,91202,265,088
11Oct 3, 2022 05:0160,589361,969,427296,887,29102,269,184
12Oct 3, 2022 05:0161,598356,054,884301,827,85102,265,088