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 18:35Dan StolyarovDan StolyarovScore: 652,500Success
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 18:35652,1093,226,122,6253,081,395,000113,940,0002,461,696
2Nov 16, 2024 18:35652,3263,227,411,1673,079,455,000116,941,0002,285,568
3Nov 16, 2024 18:35652,3273,222,604,2323,084,459,000111,944,0002,289,664
4Nov 16, 2024 18:35652,4163,224,859,8403,081,914,000114,922,0002,306,048
5Nov 16, 2024 18:35652,5003,222,127,1163,081,312,000115,936,0002,375,680
6Nov 16, 2024 18:35652,6023,223,178,2753,085,830,000111,921,0002,306,048
7Nov 16, 2024 18:35652,6073,228,076,3593,085,852,000111,922,0002,281,472
8Nov 16, 2024 18:35652,6713,224,897,7753,081,157,000116,930,0002,281,472
9Nov 16, 2024 18:35653,0703,228,798,4983,077,120,000122,924,0002,285,568