#P3409. Apple Division
Apple Division
当前没有测试数据。
Description
There are n apples with known weights. Your task is to divide the apples into two groups so that the difference between the weights of the groups is minimal.Input Format
The first input line has an integer n: the number of apples.
The next line has n integers p1,p2,…,pn: the weight of each apple.
Output Format
Print one integer: the minimum difference between the weights of the groups.5
3 2 7 4 1
1
Hint
Explanation: Group 1 has weights 2, 3 and 4 (total weight 9), and group 2 has weights 1 and 7 (total weight 8).
<li> 1≤n≤20 </li> <li> 1≤pi≤109 </li>