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 04:21Bernard TeoBernard TeoScore: 61,308Success
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 04:2160,338323,841,790293,660,0001,997,0002,281,472
2Oct 3, 2022 04:2160,364319,146,530293,786,0001,998,0002,400,256
3Oct 3, 2022 04:2160,375323,980,588293,838,0001,998,0002,281,472
4Oct 3, 2022 04:2160,426328,200,213295,089,0001,000,0002,396,160
5Oct 3, 2022 04:2160,485323,298,012295,380,000997,0002,392,064
6Oct 3, 2022 04:2160,485326,623,716295,377,0001,001,0002,392,064
7Oct 3, 2022 04:2161,308376,534,695300,409,69302,256,896
8Oct 3, 2022 04:2161,336367,003,584300,544,00102,269,184
9Oct 3, 2022 04:2161,357372,670,880300,650,20902,269,184
10Oct 3, 2022 04:2162,692327,645,612306,193,0001,000,0002,396,160
11Oct 3, 2022 04:2162,757329,418,255305,511,0001,996,0002,396,160
12Oct 3, 2022 04:2162,761332,158,539306,529,000998,0002,400,256