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 listDec 23, 2023 04:51matsuoka-601matsuoka-601Error
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 23, 2023 04:5100000Error: expected "560374590121 ", got "2977510714726365922 2977792198293207778 -3212185233671604075 -3212185233671473003 0 0 391 103 205 "
2Dec 23, 2023 05:0800000Error: expected "560378783066 ", got "5744764617807046965 5746172001281059127 -3401879589666668000 -3401879589666602464 0 0 391 161 169 "
3Dec 23, 2023 05:1100000Error: expected "560379514785 ", got "5048589858811337504 5050560187943344930 -2302839041502391911 -2302839041502064231 0 0 390 146 163 "
4Dec 23, 2023 05:1300000Error: expected "560379243071 ", got "4502894423025225208 4504020331522330107 -6495426571682854864 -6495426571682854864 0 0 390 196 137 "