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

Турниры > CEN303 2013-15 Questions > задача:


15PrE2-06. 50837 - Sum is equal to K

CEN303 2013-15 Questions

Старт: 15.дек.2013 в 14:00:00
Финиш: 15.дек.2013 в 19:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 15MdE-10. 50802 - Comparing Exams
• 15MdE-20. 50803 - Sum of the dept...
• 15MdE-40. 50805 - Sum of the weig...
• 15PrE-10. 50816 - Largest Sum Path
• 15PrE-20. 50817 - The Knight Move
• 15PrE-30. 50818 - Depth Limited BST
• 15PrE-40. 50819 - Linked Numbers
• 15PrE2-01. 50847 - The first m train...
• 15PrE2-06. 50837 - Sum is equa...
• 15Rst-10. 50857 - Nine-Stones Game
• 2.15FE-03. 50996 - Checkers - the ...

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

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

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

Sum is equal to K

Math professor of your brother gave a homework for kids. The professor gives n numbers, and he asks if number k can be produced by adding or subtracting any given number.

Question: Write a program that is going to get information and decide if it's possible to calculate the given number k or not.

Input specification
In the first line, you will be given two integers: The number of numbers(n) and the number (k) to calculate where 0 ≤ n ≤ 17 and -20,000 ≤ k ≤ 20,000. Then, in the following line, you will be given n integers where each number is between -10,000 and 10,000.

Output specification:
Show "No", if it is not possible to calculate k. Otherwise, show "Yes" in the first line. Then, in the next line show the numbers whose sum is equal to k.
Note:

  1. Each input number can be used only once.
  2. There can be many possible solutions. It is OK to show any correct solution.

Sample Input I
4 7
1 2 3 5
Sample Input II
4 8
1 2 3 10
Sample Output I
Yes
2 5
Sample Output II
Yes
-2 10



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

www.contester.ru