3 ms·
This was the problem in a Perl Golf contest a long, long time ago. There were a couple of minor differences in the spec (trillions didn't need to be handled, th
by jsnell 15y ago
This was the problem in a Perl Golf contest a long, long time ago. There were a couple of minor differences in the spec (trillions didn't need to be handled, the result needed to be pretty-printed with thousand-separator commas).
The explanation by Ton Hospel of the winning solution of 115 characters and the later improvement to 109 chars is a thing of beauty: http://www.mail-archive.com/golf@perl.org/msg01568.html http://www.mail-archive.com/golf@perl.org/msg01568.html
- lifthrasiir 15y agoI heartily agree Ton Hospel's solution is amazing (I DID know the existence of the solution), but it is not the same problem. The main difference comes from the difference between C and Perl (you cannot use crypt() in C unless you sacrifice the portability, and Perl's y/...// will cost more bytes in C), and also from the practicalness (my program filters more invalid words out, reducing false positives a lot). Therefore I believe the direct comparison is meaningless here.