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 3, 2021 14:32Yurkov AlekseyYurkov AlekseyError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 3, 2021 14:3200000Wrong answer: expected "530157694307 ", got "91110 "
2May 3, 2021 14:3300000Wrong answer: expected "530157271799 ", got "402049 "
3May 3, 2021 14:3800000Wrong answer: expected "530157205585 ", got "481053 "
4May 3, 2021 14:4300000Wrong answer: expected "530157272480 ", got "457712 "
5May 3, 2021 16:2900000Wrong answer: expected "530156841141 ", got "61635 "
6May 3, 2021 16:2900000Wrong answer: expected "530155496817 ", got "154124 "
7May 3, 2021 16:5600000Wrong answer: expected "530157959163 ", got "3782 "
8May 3, 2021 17:5000000Wrong answer: expected "530157567498 ", got "150177 "
9May 3, 2021 17:5100000Wrong answer: expected "530156417046 ", got "1173822 "
10May 3, 2021 17:5100000Wrong answer: expected "530159056502 ", got "536122 "