HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Exhaustive search & Backtracking > problem:


50600 - Expression

Guest
• Discussion of problem (1)

Section problems

• 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 - Transporter
• 50600 - Expression
• 50720 - Permutations (2)

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