Back to task

176 symbols perl
Sat Oct 24 21:16:53 2015 vakorol
#!/usr/bin/perl -ln
sub f{my($a,$r)=@_;scalar@$a==$_&&print join'',@$a;for$c(0..$_-1){my($i,$b);for(@$a){$b=1,last if$c==$_||abs($c-$_)==$r-$i++}f($A=[@$a,$c],$r+1)&&return$A if!$b}return}f([])


Leave a comment

Parsed as Markdown

Login to leave a comment