HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Exhaustive search & Backtracking > problem:


50600 - Expression

Guest
• Discussion of problem (1)

Section problems

• 50593 - Transporter
• 50711 - Snail Trails
• 50306 - Beautiful Numbers
• 50720 - Permutations (2)
• 50707 - Rebus
• 50250 - The Knight
• 50716 - All Palindromes
• 50713 - Castle and the girls
• 50600 - Expression
• 50715 - Zero Sum

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 3000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Фёдор Меньшиков, ВГПУ. Difficulty Beta

Given N integers, X1, X2, X3... XN, evaluate an expression by putting '+' or '-' signs, which is equal to a sum S.

Input
The first line contains the integers N ( N ≤ 24) and S (-1000000000 ≤ S ≤ 1 billion) . The second line contains N, integers Xi ( 0 ≤ Xi ≤ 50 million).

Output
Print out the solution, or in its absence output "No Solution".
Test 1 Test 2
3 10
15 25 30
2 100
10 10
Вывод 1 Вывод 2
15 + 25 - 30 = 10
No solution

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

www.contester.ru