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 17, 2021 23:41Yurkov 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 17, 2021 23:4100000Wrong answer: expected "530157096664 ", got "160736 "
2May 17, 2021 23:4100000Wrong answer: expected "530157041266 ", got "149569 "
3May 17, 2021 23:4100000Wrong answer: expected "530159130012 ", got "675134 "
4May 19, 2021 22:4400000Wrong answer: expected "530157545281 ", got "734229 "
5May 20, 2021 00:2300000Wrong answer: expected "530157614266 ", got "1129454 "
6May 24, 2021 17:1700000Wrong answer: expected "560377844834 ", got "509323 "
7May 19, 2021 18:337,432102,001,05036,418,01502,273,280
8May 19, 2021 18:337,43699,635,72636,434,37902,232,320
9May 19, 2021 18:327,445101,829,64436,478,05102,228,224
10May 19, 2021 18:337,446102,330,62636,485,29702,273,280
11May 19, 2021 18:337,446102,026,21236,485,74602,256,896
12May 19, 2021 18:337,466106,821,25436,581,44402,232,320
13May 19, 2021 18:327,499104,312,53336,747,32002,260,992
14May 19, 2021 18:327,565105,721,10837,070,50002,174,976
15May 19, 2021 18:337,582105,857,30837,152,29402,256,896