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 listSep 20, 2022 17:34Bernard TeoBernard TeoScore: 74,152Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 20, 2022 17:3474,102385,217,712361,101,0002,000,0002,281,472
2Sep 20, 2022 17:3474,109385,440,533361,134,0002,000,0002,400,256
3Sep 20, 2022 17:3474,118388,702,895362,177,0001,000,0002,281,472
4Sep 20, 2022 17:3474,129391,904,797362,233,0001,000,0002,392,064
5Sep 20, 2022 17:3474,133386,103,677362,253,0001,000,0002,387,968
6Sep 20, 2022 17:3474,139386,727,020362,283,0001,000,0002,400,256
7Sep 20, 2022 17:3474,152384,633,811362,347,0001,000,0002,396,160
8Sep 20, 2022 17:3474,163393,073,391363,397,00002,281,472
9Sep 20, 2022 17:3474,901390,755,852365,014,0002,000,0002,281,472
10Sep 20, 2022 17:3475,925445,744,912372,031,72102,265,088
11Sep 20, 2022 17:3476,068456,368,177372,735,20002,260,992
12Sep 20, 2022 17:3486,226481,720,857422,508,18102,265,088