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

Турниры > CEN303_2016Questions > задача:


PE21. 51071 - Phalanx-2

CEN303_2016Questions

Старт: 28.окт.2016 в 17:00:00
Финиш: 01.ноя.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• HW101. 50682 - Hotel Durres
• HW102. 51067 - Jumping frog
• HW111. 50506 - The Biggest Island
• HW112. 50698 - Ayran Delivery
• PE11. 51023 - Preparing Keyword I...
• PE12. 50835 - Club Presidency
• PE13. 51024 - Total Stock Price
• PE14. 50998 - CEN112 Homework, ...
• PE21. 51071 - Phalanx-2
• PE22. 51072 - Castle on chessboard
• RE1. 51079 - Key person - 2
• RE2. 51080 - Deepest Point

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Михаил Копачев, РГАТА.

Phalanx-2

There are n castles upon the checkered nxn-sized board, every vertical line having one castle. Let a horizontal line having at least one castle be called a bat. The position on the board will be called a phalanx if:

• the castle standing at the leftmost vertical line, stands also in the lowest horizontal line (and beats it);
• there is no gap between any two castles that separates the castle from the next or previous
• selecting first left k castles we shall get a regular phalanx of the width k.

The drawings below show four positions, two of which - those on the left are phalanxes, and those on the right are not.

Position (c) is not a regular phalanx as the second (unbeaten) horizontal line separates the second and the third castles from the lower horizontal line (condition 2 of the above list is not satisfied).
Position (d) is not a regular phalanx: if we take two left castles, they will not form a regular phalanx (condition 3 of the above list is not satisfied).

Your task is to make a program that will use the specified number n to define the quantity of different arrangements for castles m, that will be phalanxes.
For example, when n=3, it is possible to have only m=5 phalanxes (e1)-(e5)

Input
The input contains the only number n.
Output
Output must contain the only number - the answer.
Limitations
0 < n ≤ 18

Input 1 Output 1
3
5
Input 2 Output 2
5
35

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

www.contester.ru