| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11209 | N queens |
|
| 11243 | Number Tower |
|
| 11686 | more simple exercise of pointer on array |
|
Description
You have to place N queens on an N-by-N chessboard in a way that no two queens attack each other.
The rule is that each row, column, and diagonal of the board contains exactly one queen.
Your mission is to compute how many possible ways to place N queens on that chessboard.
Input
An integer N that represents the size of chessboard and the number of queens.
where 1<=N<=10
Output
An integer that represents the number of possible placements of N queens.
There is no need to add '\n' at the end of output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
There is a number tower which consists of many positive integers, and it looks like a triangle as below :
1
4 6
6 9 3
6 3 7 1
2 6 3 1 8
The first layer contains one positive integer, and the second one contains two, and so on.
Our goal is to find a path from top to bottom which has the largest sum in all paths. The path starts from the root node (the first number in the first layer), and each node can only choose one of the nearest two descendant nodes to move to. For example, 4 in the second layer can only move to 6 or 9 in the third layer. Please, sum up all the number in the path and print the largest sum.
Input
The first line is a positive integer n, that represents the height of the tower. (n <= 10) Each line in next n lines contains m positive integers whose value are not greater than 9 in the mth layer, and all number is seperated by white spaces.
Output
Print the largest value in all paths, and remenber to print a new line in the end of the anwser.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In this exercise, you should exchange the content of two given one dimensional integer arrays with same length.
We have written the code about reading the size and the content of arrays, and we want to pass them to a function for getting the final answer. What you need is helping us to complete the function.
What input into the function is two pointers representing the two arrays and the length of array, and the function has to exchange the content of the two arrays.
For more specific, you only need to implement the following function:
#include <stdio.h>
#include "function.h"
void array_exchanger(int* array_a, int* array_b, int length) {
// your code
}
The .c and .h file below might be helpful if you want to know how the function and the whole program works.
Input
The input may have 3 lines of input.
The very first line is a number, representing the length of 2 arrays.
The second and the third lines are several integers, representing the content of 2 arrays.
Output
The content in two arrays after exchanged.