12982 - Easy Eight Queens Puzzle   

Description

The eight queens puzzle is the problem of placing eight chess queens on an 8 times 8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal.

One possible solution is shown as the figure below.

Given where you place the first chess queen in column 0.

Please write a C program to tell how many possible solutions in this situation.

Input

One integer R.

Note:

  1. 7 >= R >= 0.

Output

Output should follow below format:

n

Note:

  1. Need to have a return value('\n') at the end of your output.
  2. n is the total number of solutions.
 

Sample Input  Download

Sample Output  Download

Tags




Discuss