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 18, 2021 16:09Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 18, 2021 16:0900000Wrong answer: expected "530157753208 ", got "-8061979850254975048 "
2May 18, 2021 16:0900000Wrong answer: expected "530157564186 ", got "-8552399182123545655 "
3May 18, 2021 16:0900000Wrong answer: expected "530157326124 ", got "-8858877982044788877 "
4May 18, 2021 16:1000000Wrong answer: expected "530157222952 ", got "-8216087130131827041 "
5May 19, 2021 18:205,56180,458,61827,249,26102,248,704
6May 19, 2021 18:205,58384,690,44127,358,22902,351,104
7May 19, 2021 18:205,63374,915,82627,601,44302,199,552
8May 19, 2021 18:205,63597,596,15727,611,22502,195,456
9May 19, 2021 18:205,63956,434,55427,631,34402,260,992
10May 19, 2021 18:205,64658,817,50227,664,71802,256,896