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 11, 2021 23:12Andrey 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 11, 2021 23:1200000Wrong answer: expected "530157585437 ", got "32241104457 "
2May 11, 2021 23:1200000Wrong answer: expected "530155624807 ", got "32241313478 "
3May 11, 2021 23:1200000Wrong answer: expected "530157325592 ", got "32241100116 "
4May 11, 2021 23:1300000Wrong answer: expected "530156032970 ", got "32241342504 "
5May 11, 2021 23:1300000Wrong answer: expected "530158297693 ", got "32241432827 "
6May 11, 2021 23:1300000Wrong answer: expected "530159196680 ", got "32241035765 "
7May 11, 2021 23:1300000Wrong answer: expected "530157505929 ", got "32240892940 "
8May 11, 2021 23:1300000Wrong answer: expected "530157774906 ", got "32240850647 "
9May 12, 2021 14:4200000Wrong answer: expected "530159192167 ", got "32241198803 "
10May 12, 2021 14:4200000Wrong answer: expected "530155820976 ", got "32241137343 "
11May 12, 2021 14:4200000Wrong answer: expected "530157434911 ", got "32240892263 "
12May 12, 2021 14:4200000Wrong answer: expected "530157647427 ", got "32241446466 "
13May 12, 2021 14:4200000Wrong answer: expected "530157597345 ", got "32241494787 "
14May 12, 2021 14:4200000Wrong answer: expected "530159572102 ", got "32241188463 "
15May 12, 2021 14:4200000Wrong answer: expected "530156838733 ", got "32240944117 "
16May 12, 2021 15:3200000Wrong answer: expected "530159570462 ", got "32241278612 "