Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

final!!

  • Loading branch information...
commit 773dfe0ed1fd755fb23d59342c56fbce607f74db 1 parent 3f39cca
@HemusAran authored
Showing with 9 additions and 11 deletions.
  1. +9 −11 001/C/main.pl
View
20 001/C/main.pl
@@ -3,23 +3,14 @@
use warnings;
push@_,[@F];
+$.-8&&next;
@F=@_;
our@%=0..7;
-$.-8||&M;
-
-sub M{
- Q(0);
- for$=(@%){
- $F[$=][$_]eq'Q'&&($-=$_)for@%;
- $%+=$-+1?C($=,$-):1
- }
- print$%?"No Answer\n":map{@$_}@F
-}
sub Q{
my($d)=@_;
$d-8||return 1;
- $F[$d][$_]eq'Q'&&(return Q($d+1))for@%;
+ $F[$d][$_]eq'Q'&&return Q($d+1)for@%;
for(@%){
C($d,$_)&&next;
$F[$d][$_]='Q';
@@ -34,3 +25,10 @@ sub C{
$q.=$d-$_&&$F[$_][$p].($j<0||$j<8&&$F[$_][$j]).($k<0||$k<8&&$F[$_][$k]),$j++,$k--for@%;
$q=~/Q/g
}
+
+Q(0);
+for$=(@%){
+ $F[$=][$_]eq'Q'&&($-=$_)for@%;
+ $%+=$-+1?C($=,$-):1
+}
+print$%?"No Answer\n":map{@$_}@F
Please sign in to comment.
Something went wrong with that request. Please try again.