fork download
  1. #include <iostream>
  2.  
  3. void tryQueen(int col, int n, int* trace, bool* rowFlag, bool* pDiaFlag, bool* sDiaFlag) {
  4. if (col == n) {
  5. std::cout << "Position of " << n << " queens (row, col): \n";
  6. for (int c = 0; c < n; ++c) {
  7. int r = trace[c];
  8. std::cout << "(" << r << ", " << c << ")\n";
  9. }
  10.  
  11. std::cout << "\nDrawing the board...\n";
  12. int* traceRow = new int[n]();
  13. for (int c = 0; c < n; ++c) {
  14. traceRow[trace[c]] = c;
  15. }
  16. for (int r = 0; r < n; ++r) {
  17. for (int c = 0; c < n; ++c) {
  18. std::cout << (traceRow[r] == c ? '*' : '.') << ' ';
  19. }
  20. std::cout << '\n';
  21. }
  22. std::cout << '\n';
  23.  
  24. delete[] traceRow;
  25.  
  26. return;
  27. }
  28. for (int row = 0; row < n; ++row) {
  29. if (!rowFlag[row] && !pDiaFlag[n-1+(col-row)] && !sDiaFlag[n*2-2-(row+col)]) {
  30. trace[col] = row;
  31. rowFlag[row] = true;
  32. pDiaFlag[n-1+(col-row)] = true;
  33. sDiaFlag[n*2-2-(row+col)] = true;
  34. tryQueen(col+1, n, trace, rowFlag, pDiaFlag, sDiaFlag);
  35. rowFlag[row] = false;
  36. pDiaFlag[n-1+(col-row)] = false;
  37. sDiaFlag[n*2-2-(row+col)] = false;
  38. }
  39. }
  40. }
  41.  
  42. int main() {
  43. int n;
  44. std::cout << "Enter n: ";
  45. std::cin >> n;
  46.  
  47. int* trace = new int[n]();
  48. bool* rowFlag = new bool[n]();
  49. bool* pDiaFlag = new bool[n*2-1]();
  50. bool* sDiaFlag = new bool[n*2-1]();
  51.  
  52. tryQueen(0, n, trace, rowFlag, pDiaFlag, sDiaFlag);
  53.  
  54. delete[] trace;
  55. delete[] rowFlag;
  56. delete[] pDiaFlag;
  57. delete[] sDiaFlag;
  58.  
  59. return 0;
  60. }
Success #stdin #stdout 0.01s 5544KB
stdin
8
stdout
Enter n: Position of 8 queens (row, col): 
(0, 0)
(4, 1)
(7, 2)
(5, 3)
(2, 4)
(6, 5)
(1, 6)
(3, 7)

Drawing the board...
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(0, 0)
(5, 1)
(7, 2)
(2, 3)
(6, 4)
(3, 5)
(1, 6)
(4, 7)

Drawing the board...
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(0, 0)
(6, 1)
(3, 2)
(5, 3)
(7, 4)
(1, 5)
(4, 6)
(2, 7)

Drawing the board...
* . . . . . . . 
. . . . . * . . 
. . . . . . . * 
. . * . . . . . 
. . . . . . * . 
. . . * . . . . 
. * . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(0, 0)
(6, 1)
(4, 2)
(7, 3)
(1, 4)
(3, 5)
(5, 6)
(2, 7)

Drawing the board...
* . . . . . . . 
. . . . * . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(1, 0)
(3, 1)
(5, 2)
(7, 3)
(2, 4)
(0, 5)
(6, 6)
(4, 7)

Drawing the board...
. . . . . * . . 
* . . . . . . . 
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 
. . * . . . . . 
. . . . . . * . 
. . . * . . . . 

Position of 8 queens (row, col): 
(1, 0)
(4, 1)
(6, 2)
(0, 3)
(2, 4)
(7, 5)
(5, 6)
(3, 7)

Drawing the board...
. . . * . . . . 
* . . . . . . . 
. . . . * . . . 
. . . . . . . * 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(1, 0)
(4, 1)
(6, 2)
(3, 3)
(0, 4)
(7, 5)
(5, 6)
(2, 7)

Drawing the board...
. . . . * . . . 
* . . . . . . . 
. . . . . . . * 
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(1, 0)
(5, 1)
(0, 2)
(6, 3)
(3, 4)
(7, 5)
(2, 6)
(4, 7)

Drawing the board...
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(1, 0)
(5, 1)
(7, 2)
(2, 3)
(0, 4)
(3, 5)
(6, 6)
(4, 7)

Drawing the board...
. . . . * . . . 
* . . . . . . . 
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 

Position of 8 queens (row, col): 
(1, 0)
(6, 1)
(2, 2)
(5, 3)
(7, 4)
(4, 5)
(0, 6)
(3, 7)

Drawing the board...
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 
. * . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(1, 0)
(6, 1)
(4, 2)
(7, 3)
(0, 4)
(3, 5)
(5, 6)
(2, 7)

Drawing the board...
. . . . * . . . 
* . . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(1, 0)
(7, 1)
(5, 2)
(0, 3)
(2, 4)
(4, 5)
(6, 6)
(3, 7)

Drawing the board...
. . . * . . . . 
* . . . . . . . 
. . . . * . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 

Position of 8 queens (row, col): 
(2, 0)
(0, 1)
(6, 2)
(4, 3)
(7, 4)
(1, 5)
(3, 6)
(5, 7)

Drawing the board...
. * . . . . . . 
. . . . . * . . 
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 
. . . . . . . * 
. . * . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(2, 0)
(4, 1)
(1, 2)
(7, 3)
(0, 4)
(6, 5)
(3, 6)
(5, 7)

Drawing the board...
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(2, 0)
(4, 1)
(1, 2)
(7, 3)
(5, 4)
(3, 5)
(6, 6)
(0, 7)

Drawing the board...
. . . . . . . * 
. . * . . . . . 
* . . . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . * . . . 
. . . . . . * . 
. . . * . . . . 

Position of 8 queens (row, col): 
(2, 0)
(4, 1)
(6, 2)
(0, 3)
(3, 4)
(1, 5)
(7, 6)
(5, 7)

Drawing the board...
. . . * . . . . 
. . . . . * . . 
* . . . . . . . 
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 
. . * . . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(2, 0)
(4, 1)
(7, 2)
(3, 3)
(0, 4)
(6, 5)
(1, 6)
(5, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(1, 2)
(4, 3)
(7, 4)
(0, 5)
(6, 6)
(3, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . . * 
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(1, 2)
(6, 3)
(0, 4)
(3, 5)
(7, 6)
(4, 7)

Drawing the board...
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(1, 2)
(6, 3)
(4, 4)
(0, 5)
(7, 6)
(3, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . . * 
. . . . * . . . 
. * . . . . . . 
. . . * . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(3, 2)
(0, 3)
(7, 4)
(4, 5)
(6, 6)
(1, 7)

Drawing the board...
. . . * . . . . 
. . . . . . . * 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(3, 2)
(1, 3)
(7, 4)
(4, 5)
(6, 6)
(0, 7)

Drawing the board...
. . . . . . . * 
. . . * . . . . 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(7, 2)
(0, 3)
(3, 4)
(6, 5)
(4, 6)
(1, 7)

Drawing the board...
. . . * . . . . 
. . . . . . . * 
* . . . . . . . 
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(7, 2)
(0, 3)
(4, 4)
(6, 5)
(1, 6)
(3, 7)

Drawing the board...
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 
. . . . . . . * 
. . . . * . . . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(2, 0)
(5, 1)
(7, 2)
(1, 3)
(3, 4)
(0, 5)
(6, 6)
(4, 7)

Drawing the board...
. . . . . * . . 
. . . * . . . . 
* . . . . . . . 
. . . . * . . . 
. . . . . . . * 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 

Position of 8 queens (row, col): 
(2, 0)
(6, 1)
(1, 2)
(7, 3)
(4, 4)
(0, 5)
(3, 6)
(5, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(2, 0)
(6, 1)
(1, 2)
(7, 3)
(5, 4)
(3, 5)
(0, 6)
(4, 7)

Drawing the board...
. . . . . . * . 
. . * . . . . . 
* . . . . . . . 
. . . . . * . . 
. . . . . . . * 
. . . . * . . . 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(2, 0)
(7, 1)
(3, 2)
(6, 3)
(0, 4)
(5, 5)
(1, 6)
(4, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 
. * . . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(0, 1)
(4, 2)
(7, 3)
(1, 4)
(6, 5)
(2, 6)
(5, 7)

Drawing the board...
. * . . . . . . 
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(3, 0)
(0, 1)
(4, 2)
(7, 3)
(5, 4)
(2, 5)
(6, 6)
(1, 7)

Drawing the board...
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 
. . . . . . * . 
. . . * . . . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(4, 2)
(7, 3)
(5, 4)
(0, 5)
(2, 6)
(6, 7)

Drawing the board...
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 
. . . . . . . * 
. . . * . . . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(6, 2)
(2, 3)
(5, 4)
(7, 5)
(0, 6)
(4, 7)

Drawing the board...
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 
* . . . . . . . 
. . . . . . . * 
. . . . * . . . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(6, 2)
(2, 3)
(5, 4)
(7, 5)
(4, 6)
(0, 7)

Drawing the board...
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(6, 2)
(4, 3)
(0, 4)
(7, 5)
(5, 6)
(2, 7)

Drawing the board...
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 
* . . . . . . . 
. . . * . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(7, 2)
(4, 3)
(6, 4)
(0, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
* . . . . . . . 
. . . * . . . . 
. . . . . . . * 
. . . . * . . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(1, 1)
(7, 2)
(5, 3)
(0, 4)
(2, 5)
(4, 6)
(6, 7)

Drawing the board...
. . . . * . . . 
. * . . . . . . 
. . . . . * . . 
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 
. . . . . . . * 
. . * . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(5, 1)
(0, 2)
(4, 3)
(1, 4)
(7, 5)
(2, 6)
(6, 7)

Drawing the board...
. . * . . . . . 
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 

Position of 8 queens (row, col): 
(3, 0)
(5, 1)
(7, 2)
(1, 3)
(6, 4)
(0, 5)
(2, 6)
(4, 7)

Drawing the board...
. . . . . * . . 
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(5, 1)
(7, 2)
(2, 3)
(0, 4)
(6, 5)
(4, 6)
(1, 7)

Drawing the board...
. . . . * . . . 
. . . . . . . * 
. . . * . . . . 
* . . . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(6, 1)
(0, 2)
(7, 3)
(4, 4)
(1, 5)
(5, 6)
(2, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
* . . . . . . . 
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(3, 0)
(6, 1)
(2, 2)
(7, 3)
(1, 4)
(4, 5)
(0, 6)
(5, 7)

Drawing the board...
. . . . . . * . 
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(3, 0)
(6, 1)
(4, 2)
(1, 3)
(5, 4)
(0, 5)
(2, 6)
(7, 7)

Drawing the board...
. . . . . * . . 
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 

Position of 8 queens (row, col): 
(3, 0)
(6, 1)
(4, 2)
(2, 3)
(0, 4)
(5, 5)
(7, 6)
(1, 7)

Drawing the board...
. . . . * . . . 
. . . . . . . * 
. . . * . . . . 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(3, 0)
(7, 1)
(0, 2)
(2, 3)
(5, 4)
(1, 5)
(6, 6)
(4, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. . . * . . . . 
* . . . . . . . 
. . . . . . . * 
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(7, 1)
(0, 2)
(4, 3)
(6, 4)
(1, 5)
(5, 6)
(2, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
* . . . . . . . 
. . . * . . . . 
. . . . . . * . 
. . . . * . . . 
. * . . . . . . 

Position of 8 queens (row, col): 
(3, 0)
(7, 1)
(4, 2)
(2, 3)
(0, 4)
(6, 5)
(1, 6)
(5, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
. . . * . . . . 
* . . . . . . . 
. . * . . . . . 
. . . . . . . * 
. . . . . * . . 
. * . . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(0, 1)
(3, 2)
(5, 3)
(7, 4)
(1, 5)
(6, 6)
(2, 7)

Drawing the board...
. * . . . . . . 
. . . . . * . . 
. . . . . . . * 
. . * . . . . . 
* . . . . . . . 
. . . * . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(4, 0)
(0, 1)
(7, 2)
(3, 3)
(1, 4)
(6, 5)
(2, 6)
(5, 7)

Drawing the board...
. * . . . . . . 
. . . . * . . . 
. . . . . . * . 
. . . * . . . . 
* . . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(0, 1)
(7, 2)
(5, 3)
(2, 4)
(6, 5)
(1, 6)
(3, 7)

Drawing the board...
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . . . . . . * 
* . . . . . . . 
. . . * . . . . 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(1, 1)
(3, 2)
(5, 3)
(7, 4)
(2, 5)
(0, 6)
(6, 7)

Drawing the board...
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . * . . . . 
. . . . . . . * 
. . . . * . . . 

Position of 8 queens (row, col): 
(4, 0)
(1, 1)
(3, 2)
(6, 3)
(2, 4)
(7, 5)
(5, 6)
(0, 7)

Drawing the board...
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(4, 0)
(1, 1)
(5, 2)
(0, 3)
(6, 4)
(3, 5)
(7, 6)
(2, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(4, 0)
(1, 1)
(7, 2)
(0, 3)
(3, 4)
(6, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 
* . . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(2, 1)
(0, 2)
(5, 3)
(7, 4)
(1, 5)
(3, 6)
(6, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
* . . . . . . . 
. . . * . . . . 
. . . . . . . * 
. . . . * . . . 

Position of 8 queens (row, col): 
(4, 0)
(2, 1)
(0, 2)
(6, 3)
(1, 4)
(7, 5)
(5, 6)
(3, 7)

Drawing the board...
. . * . . . . . 
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(4, 0)
(2, 1)
(7, 2)
(3, 3)
(6, 4)
(0, 5)
(5, 6)
(1, 7)

Drawing the board...
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(0, 2)
(2, 3)
(7, 4)
(5, 5)
(3, 6)
(1, 7)

Drawing the board...
. . * . . . . . 
. . . . . . . * 
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(0, 2)
(3, 3)
(1, 4)
(7, 5)
(5, 6)
(2, 7)

Drawing the board...
. . * . . . . . 
. . . . * . . . 
. . . . . . . * 
. . . * . . . . 
* . . . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(1, 2)
(3, 3)
(7, 4)
(0, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. . . * . . . . 
* . . . . . . . 
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(1, 2)
(5, 3)
(2, 4)
(0, 5)
(3, 6)
(7, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(1, 2)
(5, 3)
(2, 4)
(0, 5)
(7, 6)
(3, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
. . . . * . . . 
. . . . . . . * 
* . . . . . . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(4, 0)
(6, 1)
(3, 2)
(0, 3)
(2, 4)
(7, 5)
(5, 6)
(1, 7)

Drawing the board...
. . . * . . . . 
. . . . . . . * 
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(4, 0)
(7, 1)
(3, 2)
(0, 3)
(2, 4)
(5, 5)
(1, 6)
(6, 7)

Drawing the board...
. . . * . . . . 
. . . . . . * . 
. . . . * . . . 
. . * . . . . . 
* . . . . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 

Position of 8 queens (row, col): 
(4, 0)
(7, 1)
(3, 2)
(0, 3)
(6, 4)
(1, 5)
(5, 6)
(2, 7)

Drawing the board...
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 
. * . . . . . . 

Position of 8 queens (row, col): 
(5, 0)
(0, 1)
(4, 2)
(1, 3)
(7, 4)
(2, 5)
(6, 6)
(3, 7)

Drawing the board...
. * . . . . . . 
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(5, 0)
(1, 1)
(6, 2)
(0, 3)
(2, 4)
(4, 5)
(7, 6)
(3, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . * . . . 
. . . . . . . * 
. . . . . * . . 
* . . . . . . . 
. . * . . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(5, 0)
(1, 1)
(6, 2)
(0, 3)
(3, 4)
(7, 5)
(4, 6)
(2, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(0, 2)
(6, 3)
(4, 4)
(7, 5)
(1, 6)
(3, 7)

Drawing the board...
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . . . * 
. . . . * . . . 
* . . . . . . . 
. . . * . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(0, 2)
(7, 3)
(3, 4)
(1, 5)
(6, 6)
(4, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . * . . . 
. . . . . . . * 
* . . . . . . . 
. . . . . . * . 
. . . * . . . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(0, 2)
(7, 3)
(4, 4)
(1, 5)
(3, 6)
(6, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. * . . . . . . 
. . . . . . * . 
. . . . * . . . 
* . . . . . . . 
. . . . . . . * 
. . . * . . . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(4, 2)
(6, 3)
(0, 4)
(3, 5)
(1, 6)
(7, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . * . . . . 
. . . . . . . * 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(4, 2)
(7, 3)
(0, 4)
(3, 5)
(1, 6)
(6, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . * . . 
. . * . . . . . 
* . . . . . . . 
. . . . . . . * 
. . . * . . . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(6, 2)
(1, 3)
(3, 4)
(7, 5)
(0, 6)
(4, 7)

Drawing the board...
. . . . . . * . 
. . . * . . . . 
. * . . . . . . 
. . . . * . . . 
. . . . . . . * 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(6, 2)
(1, 3)
(7, 4)
(4, 5)
(0, 6)
(3, 7)

Drawing the board...
. . . . . . * . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(5, 0)
(2, 1)
(6, 2)
(3, 3)
(0, 4)
(7, 5)
(1, 6)
(4, 7)

Drawing the board...
. . . . * . . . 
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 
. . . . . . . * 
* . . . . . . . 
. . * . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(5, 0)
(3, 1)
(0, 2)
(4, 3)
(7, 4)
(1, 5)
(6, 6)
(2, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . * . . . . 
* . . . . . . . 
. . . . . . * . 
. . . . * . . . 

Position of 8 queens (row, col): 
(5, 0)
(3, 1)
(1, 2)
(7, 3)
(4, 4)
(6, 5)
(0, 6)
(2, 7)

Drawing the board...
. . . . . . * . 
. . * . . . . . 
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 
* . . . . . . . 
. . . . . * . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(5, 0)
(3, 1)
(6, 2)
(0, 3)
(2, 4)
(4, 5)
(1, 6)
(7, 7)

Drawing the board...
. . . * . . . . 
. . . . . . * . 
. . . . * . . . 
. * . . . . . . 
. . . . . * . . 
* . . . . . . . 
. . * . . . . . 
. . . . . . . * 

Position of 8 queens (row, col): 
(5, 0)
(3, 1)
(6, 2)
(0, 3)
(7, 4)
(1, 5)
(4, 6)
(2, 7)

Drawing the board...
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. * . . . . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(5, 0)
(7, 1)
(1, 2)
(3, 3)
(0, 4)
(6, 5)
(4, 6)
(2, 7)

Drawing the board...
. . . . * . . . 
. . * . . . . . 
. . . . . . . * 
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 
. . . . . * . . 
. * . . . . . . 

Position of 8 queens (row, col): 
(6, 0)
(0, 1)
(2, 2)
(7, 3)
(5, 4)
(3, 5)
(1, 6)
(4, 7)

Drawing the board...
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
. . . . * . . . 
* . . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(6, 0)
(1, 1)
(3, 2)
(0, 3)
(7, 4)
(4, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
* . . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(6, 0)
(1, 1)
(5, 2)
(2, 3)
(0, 4)
(3, 5)
(7, 6)
(4, 7)

Drawing the board...
. . . . * . . . 
. * . . . . . . 
. . . * . . . . 
. . . . . * . . 
. . . . . . . * 
. . * . . . . . 
* . . . . . . . 
. . . . . . * . 

Position of 8 queens (row, col): 
(6, 0)
(2, 1)
(0, 2)
(5, 3)
(7, 4)
(4, 5)
(1, 6)
(3, 7)

Drawing the board...
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 
* . . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(6, 0)
(2, 1)
(7, 2)
(1, 3)
(4, 4)
(0, 5)
(5, 6)
(3, 7)

Drawing the board...
. . . . . * . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . * . . . 
. . . . . . * . 
* . . . . . . . 
. . * . . . . . 

Position of 8 queens (row, col): 
(6, 0)
(3, 1)
(1, 2)
(4, 3)
(7, 4)
(0, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . * . . . . 
. . . . . . . * 
* . . . . . . . 
. . . . * . . . 

Position of 8 queens (row, col): 
(6, 0)
(3, 1)
(1, 2)
(7, 3)
(5, 4)
(0, 5)
(2, 6)
(4, 7)

Drawing the board...
. . . . . * . . 
. . * . . . . . 
. . . . . . * . 
. * . . . . . . 
. . . . . . . * 
. . . . * . . . 
* . . . . . . . 
. . . * . . . . 

Position of 8 queens (row, col): 
(6, 0)
(4, 1)
(2, 2)
(0, 3)
(5, 4)
(7, 5)
(1, 6)
(3, 7)

Drawing the board...
. . . * . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . . . * 
. * . . . . . . 
. . . . * . . . 
* . . . . . . . 
. . . . . * . . 

Position of 8 queens (row, col): 
(7, 0)
(1, 1)
(3, 2)
(0, 3)
(6, 4)
(4, 5)
(2, 6)
(5, 7)

Drawing the board...
. . . * . . . . 
. * . . . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . * . . 
. . . . . . . * 
. . . . * . . . 
* . . . . . . . 

Position of 8 queens (row, col): 
(7, 0)
(1, 1)
(4, 2)
(2, 3)
(0, 4)
(6, 5)
(3, 6)
(5, 7)

Drawing the board...
. . . . * . . . 
. * . . . . . . 
. . . * . . . . 
. . . . . . * . 
. . * . . . . . 
. . . . . . . * 
. . . . . * . . 
* . . . . . . . 

Position of 8 queens (row, col): 
(7, 0)
(2, 1)
(0, 2)
(5, 3)
(1, 4)
(4, 5)
(6, 6)
(3, 7)

Drawing the board...
. . * . . . . . 
. . . . * . . . 
. * . . . . . . 
. . . . . . . * 
. . . . . * . . 
. . . * . . . . 
. . . . . . * . 
* . . . . . . . 

Position of 8 queens (row, col): 
(7, 0)
(3, 1)
(0, 2)
(2, 3)
(5, 4)
(1, 5)
(6, 6)
(4, 7)

Drawing the board...
. . * . . . . . 
. . . . . * . . 
. . . * . . . . 
. * . . . . . . 
. . . . . . . * 
. . . . * . . . 
. . . . . . * . 
* . . . . . . .