ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Camp. Turkey > задача:


The N Queens Problem

Задачи сборника

• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Permutations
• Reverse permutation
• Divisors count
• GCD of ones
• Set cover problem
• Subsets
• The N Queens Problem
• Maximum Sum 2
• Gifts of Santa Claus
• Shopping
• Diameter of graph
• Corridor
• Prime numbers
• Rectangles on a plane
• Делители

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 10000/10000/10000/10000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

Problem description

The goal of the n-queens problem is to position n queens on an nxn chessboard so that no two queens threaten each other. That is, no two queens may be in the same row, column, or diagonal.

Make a program to calculate number of the solution of n-queens problem.

Input

A single integer N (1 <= N <= 14) that is the size of the board.

Output

A single integer denotes the number of different solutions.

Example

stdin stdout

4

2

Для отправки решений необходимо выполнить вход.

www.contester.ru