АВТ
Language:

Remote Training on Programming

Problems On-line status Contests FAQ
For authors:
Register  ||  Login
 
Hello, Guest! Login or register.

866. Heap of Stones - 1

Time Limit: 1 seconds
Memory Limit:65535KB
Points:10
View Problem Statistics Submit Problem added Administrator

Имеется N камней разного веса.
Требуется разложить их на две кучки так, чтобы разница весов этих кучек была как можно меньше.

Input

В первой строке входного файла находится число N - количество камней (1<=N<=20).
В следующих строках располагаются N целых чисел - веса камней (в интервале от 1 до 108). Числа разделяются пробелами и/или переводами строк.

Output

Выведите одно число - минимально возможный модуль разности весов кучек.

Sample

InputOutput
4
1 5 2 3
1

View Problem Statistics Submit Author/source:
Sorted Problems / Enumeration of Possibilities /
680. 12 Knights 866.
Problems from Contests / VoSTU Selection Rounds / Selection Round to Rybinsk 2010 /
865. A - Number of Pages in the Book 866. 867. C - Heap of Stones - 2 868. D - Cut up Boards
We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems. Donald E. Knuth.
time generating 0.624 sec.
© Copyright VSTU, AVT, Nosov D.A.