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

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


50713 - Castle and the girls

Гость
• Обсуждение задачи (1)

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

• 50265 - Liars and Knights
• 51071 - Phalanx-2
• 50715 - Zero Sum
• 50711 - Snail Trails
• 50472 - Minimum Sum Triangle
• 50306 - Beautiful Numbers
• 50716 - All Palindromes
• 50714 - The knight
• 50713 - Castle and the girls
• 50710 - Permutations
• 50709 - k-ary Strings
• 50708 - Binary Strings
• 50996 - Checkers - the shortest path
• Check-Mate
• 50479 - Bit Compressor
• 50486 - Problems and Programmers
• 50712 - Moon algebra

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by: Ilir Capuni. Сложность Бета

Castle and the girls

A castle has a square shape, and along each side it has three rooms.

How can we accommodate n girls in the rooms of the castle such that all of the following are fulfilled:

1) the numbers of girls in each side the of the squares are equal;

2) each room contains at most m girls

3) the numbers of girls in the rooms on the corners of the square are equal.

Input description: You will be given two integers n and m (1<=n<=1.000 and 1<=m<=100)

Output description: You will output in the given format the possible ways to accommodate the girls, or “Impossible” if it’s not possible.

 

Sample 1

Sample 2

Input:

16 5

60 1

Output:

[1, 2, 1]

[2, 4, 2]

[1, 2, 1]

 

[1, 3, 1]

[3, 0, 3]

[1, 3, 1]

 

[2, 1, 2]

[1, 4, 1]

[2, 1, 2]

 

[2, 2, 2]

[2, 0, 2]

[2, 2, 2]

 

[3, 0, 3]

[0, 4, 0]

[3, 0, 3]

 

[3, 1, 3]

[1, 0, 1]

[3, 1, 3]

 

[4, 0, 4]

[0, 0, 0]

[4, 0, 4]

Impossible

 

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

www.contester.ru