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.
1172: Hiking
时间限制:1000 ms 内存限制:128 MB提交:152 解决:48
[ 提交][ 状态][ 讨论版]
题目描述
输入
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
来源
한국어中文فارسیEnglishไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2024Xidian Programming Contest Online JudgeTEAM
GPL2.02003-2014HUSTOJ ProjectTEAM