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 listJul 5, 2024 15:36Franek KortaFranek KortaError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jul 5, 2024 15:3000000Error: expected "560382813339 ", got "560382812331 "stderr
2Jul 5, 2024 15:35237,0491,226,695,6711,161,539,78802,252,800
3Jul 5, 2024 15:35237,3431,237,772,2691,162,982,83302,240,512
4Jul 5, 2024 15:36237,5591,225,559,4561,164,039,25802,244,608
5Jul 5, 2024 15:36237,7281,244,160,8231,164,868,05402,248,704
6Jul 5, 2024 15:35238,7851,226,590,6271,170,047,02202,236,416
7Jul 5, 2024 15:36238,8381,239,225,9041,170,304,00402,252,800