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 10:12Yurkov 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 10:1200000Wrong answer: expected: 1009889661 got: 13|7|5|7|10|9|3|12|10|4|2|8|3|9|9|14|4|12|10|5|6|13|2|8|12|8|1|8|12|2|12|15|2|13|7|9|8|2|6|10|5|15|10|5|3|8|2|15|13|10|9|5|9|13|12|15|9|7|10|1|6|6|8|3|10|11|7|15|11|8|1|1|14|13|6|15|9|11|2|7|10|14|2|3|12|15|12|...