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 18:20Yuriy LyfenkoYuriy LyfenkoError
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 18:2000000Wrong answer: expected "530155328004 ", got "106030360197 "
2May 3, 2021 18:2100000Wrong answer: expected "530159174284 ", got "106033348088 "
3May 3, 2021 18:2100000Wrong answer: expected "530157459840 ", got "106031666696 "
4May 3, 2021 18:2500000Wrong answer: expected "530157925495 ", got "106031196249 "
5May 3, 2021 18:3200000Wrong answer: expected "530156920793 ", got "106032844319 "
6May 3, 2021 18:3500000Wrong answer: expected "530155218468 ", got "106029536133 "
7May 3, 2021 18:3500000Wrong answer: expected "530157751553 ", got "106030842252 "
8May 3, 2021 18:3500000Wrong answer: expected "530156811555 ", got "106032709804 "
9May 3, 2021 18:3600000Wrong answer: expected "530156775783 ", got "106032702623 "