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 2, 2021 02:23Yuriy LyfenkoYuriy LyfenkoScore: 142,475Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jul 2, 2021 02:23138,6291,205,345,795678,283,0001,000,0002,510,848
2Jul 2, 2021 02:23138,8641,210,184,591679,434,000999,0002,523,136
3Jul 2, 2021 02:23140,0791,213,069,506684,389,0001,998,0002,514,944
4Jul 2, 2021 02:23141,2921,222,882,298690,331,0001,998,0002,523,136
5Jul 2, 2021 02:23141,4411,213,600,915692,059,0001,000,0002,519,040
6Jul 2, 2021 02:23141,9261,223,258,317693,439,0001,998,0002,514,944
7Jul 2, 2021 02:23142,4751,223,375,872697,128,0001,000,0002,514,944
8Jul 2, 2021 02:23143,5961,236,264,418701,621,0001,998,0002,510,848
9Jul 2, 2021 02:23146,2711,248,053,674715,729,000999,0002,510,848
10Jul 2, 2021 02:23157,8441,324,627,571773,436,06402,236,416
11Jul 2, 2021 02:23158,6961,336,770,931777,608,74202,228,224
12Jul 2, 2021 02:23160,5541,344,949,674786,714,19802,244,608