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 7, 2021 21:29Yuriy 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 7, 2021 21:2900000Wrong answer: expected "530157078469 ", got "11581638218306966523 "
2May 7, 2021 21:3100000Wrong answer: expected "530159379899 ", got "12474623590173008799 "
3May 7, 2021 21:3200000Wrong answer: expected "530157840371 ", got "11821013368335602267 "
4May 9, 2021 19:5100000Wrong answer: expected "530156880961 ", got "11939632350677945663 "
5May 9, 2021 19:5300000Wrong answer: expected "530156839810 ", got "11661086592156899172 "
6May 19, 2021 21:4200000Wrong answer: expected "530155509654 ", got "10713884839580202466 "