| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12982 | Easy Eight Queens Puzzle |
|
| 12983 | Implement Set Using Linked List II |
|
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:
- 7 >= R >= 0.
Output
Output should follow below format:
n
Note:
- Need to have a return value('\n') at the end of your output.
- n is the total number of solutions.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please use the provided two files, main.c and function.h, to implement a set. Includes following functions:
- Insert N: insert an element which value is N into a set.
- Erase N: remove the element which value is N from a set.
- Check N: check if the element which value is N is inside a set.
- Traversal: traversal the set.
Note:
- A Set data structure shold never have a same element inside.
- Elements inside a set should be arranged from large to small.
Go download function.c, and only need to submit function.c.
Input
Legal commands:
- “insert N”: Insert an element which value is N into the set.
- “erase N”: Remove the element which value is N and return its pointer. Remove nothing is there is no element which value is N.
- “check N”: Check if the element which value is N is inside a set. Print “true\n” if it’s inside, print “false\n” if it’s not.
- “print”: Traversal the set, and print every element in ordered. Print “Set is empty\n” if set is empty.
Output
No need to handle output. Please use function.c above.