CSES Problemset/Introductory Problems
Apple Division
#1623Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopThere are 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
The first input line has an integer : the number of apples.
The next line has integers : the weight of each apple.
Output
Print one integer: the minimum difference between the weights of the groups.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
5 3 2 7 4 1
Expected Output
1
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
5 3 2 7 4 1
Expected Output
1