Created
December 20, 2014 19:37
-
-
Save tmn/d49c1ca3c94bb27edc68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my %sets = (); | |
| sub check { | |
| my ($x, $y) = @{$_[0]}; | |
| return if (exists $sets{$x.','.$y} || (eval join "+", (abs $x . abs $y)=~/./g) > 19); | |
| $sets{$x.','.$y} = 1; | |
| check($_) foreach ([$x + 1, $y], [$x - 1, $y], [$x, $y + 1], [$x, $y - 1]); | |
| } | |
| check([0, 0]); | |
| print scalar keys %sets; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment