diff --git a/backtracking/n_queens_all_solution_optimised.cpp b/backtracking/n_queens_all_solution_optimised.cpp index 62226cd3f..40056100d 100644 --- a/backtracking/n_queens_all_solution_optimised.cpp +++ b/backtracking/n_queens_all_solution_optimised.cpp @@ -2,20 +2,15 @@ #define n 4 #define inc_loop(var, start, stop, step) for (int var=start; var <= stop; var+=step) #define dec_loop(var, start, stop, step) for (int var=start; var >= stop; var-=step) - -void PrintSol(int Board[n][n]) -{ - inc_loop(i,0,n-1,1) - { +void PrintSol(int Board[n][n]) { + inc_loop(i,0,n-1,1) { inc_loop(j,0,n-1,1) std::cout << Board[i][j] << " "; std::cout << std::endl; } std::cout << std::endl; - if (n%2==0 || (n%2==1 && Board[n/2+1][0]!=1)) - { - inc_loop(i,0,n-1,1) - { + if (n%2==0 || (n%2==1 && Board[n/2+1][0]!=1)){ + inc_loop(i,0,n-1,1){ dec_loop(j,n-1,0,1) std::cout<