Skip to content

Perl fun (at last)

After reading something about dynamic programming problems (and thanks to Perl's very liberal parser for the alignment)...

Copy and distribution of the code published in this page, with or without
modification, are permitted in any medium without royalty provided the copyright
notice (see bottom of page) and this notice are preserved.
map{ord}"a#Q, J!!A%(V&)#(M-!!P).P"=~/./g;for($w..14567){if($_%$w){$p=$_-$w;$m[
:$y}}for(;$n;$n--){$m[$a=$n*$w+$W]!=$m[$a-$w]and print chr$v[$n]and$W-=$w[$n]}

The only fact it exploits is that undefined values implicitly become 0 when used in calculations. Indeed, if the necessary declarations and initializations are added (not shown), the code runs without warnings under use warnings; and use strict;.

Be Sociable, Share!

Leave a Reply