主页 讨论版 问题 名次 状态 统计
欢迎加入西电微软俱乐部招新群 588166170,做出福利题,免技术部第一次面试且赠送“福利”海报或小礼品~~~~
问题 C: Hiking

问题 C: Hiking

时间限制: 1 Sec  内存限制: 128 MB
提交: 139  解决: 43
[提交][状态][讨论版]

题目描述

BlacKin and GKCY are going hiking together.
Besides their personal items, there are some items they share together.
They decided to devide those shared items into two parts.
So each of them has to carry their own items and a part of shared items.
To make it fair, they hope the weight difference between those two parts can be as small as possible.
Now they want to know how small it can be.

输入

Multiple test cases, please read until EOF
For each test case:
First line a single integer n (1 <= n <= 200), number of shared items.
Second line n integers, Wi (1 <= Wi <= 200), weight of each item.

输出

For each test case:
One line a single integer, the smallest difference between two part.

样例输入

1
7
3
1 2 3
3
11 1 2

样例输出

7
0
8

提示

for the sample data


test case 1

part1  7

part2  0

diff   7



test case 1

part1  1 + 2 = 3

part2  3

diff   0



test case 1

part1  11

part2  1 + 2 = 3

diff   8

[提交][状态][讨论版]