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

Разделы > Переборные задачи > задача:


50490 - Across the River

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

Задачи раздела

• 50708 - Binary Strings
• 50996 - Checkers - the shortest path
• Check-Mate
• 50479 - Bit Compressor
• 50486 - Problems and Programmers
• 50712 - Moon algebra
• 50717 - Hurdle Jumping
• 50840 - Tanker trucks
• 50490 - Across the River
• 50828 - Arranging Time Table
• 51067 - Jumping frog
• 51142 - Jump Min Value
• 51082 - Sum is equal to K - 1
• Post Office Delivery
• 50506 - The Biggest Island
• 50718 - Elevator
• 50593 - Transportimi

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Across the River

There are n people escaping from the war. They have to cross over a river. There is a boat which can carry k people. After crossing the river, they can pull back the boat using a string. To provide security on both sides of the river, certain people cannot leave together. At least one soldier must exist on either side of the river.

Question: Write a program that is going to read the people information and decide by how many different ways all the people can cross the river.

Input specification: There are 3 integers in the first line:

  • n: the number of people
  • m: the number of soldiers where m is between 2 and 4
  • k: the number of people the boat can carry
where 0 < n < 8, 1 < m ≤ 4, and 2 ≤ k ≤ 6, and k is a multiple of (m+n) The following line lists the name of n people separated by spaces. The last line contains the name of the soldiers. Names contain only 26 English uppercase or lowercase characters.

Output specification
Show one integer: the number of different ways all the people can cross the river.

Sample Input I
2 2 2
Andi Anisa
Ani Geri
Sample Output I
4

Explanation: There are 4 possible ways that they can use the boat and cross over a river. The soldiers below are underlined.

  1. [Andi Ani] - [Anisa Geri]
  2. [Andi Geri] - [Anisa Ani]
  3. [Anisa Ani] - [Andi Geri]
  4. [Anisa Geri] - [Andi Ani]


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

www.contester.ru