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 listMay 19, 2021 21:43Andrey TsvetkovAndrey TsvetkovScore: 1,144,981Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 19, 2021 21:431,073,2695,332,272,9965,259,017,87802,207,744
2May 19, 2021 21:431,073,3065,330,132,5145,259,201,83202,211,840
3May 19, 2021 21:431,073,3865,332,608,2665,259,590,18602,207,744
4May 19, 2021 21:431,144,9445,672,761,9505,610,223,73802,211,840
5May 19, 2021 21:431,144,9815,669,685,6485,610,409,16502,203,648
6May 19, 2021 21:431,145,0495,671,255,6795,610,737,82402,207,744
7May 19, 2021 21:431,145,1085,670,435,2615,611,030,74602,207,744
8May 19, 2021 21:431,145,3605,677,391,6155,612,262,27702,207,744
9May 19, 2021 21:431,145,3965,672,880,9395,612,438,68302,211,840