From 1bd17a77301438997ccc4e3eaf7ebe04474a5767 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Wed, 19 Feb 2025 11:48:40 -0700 Subject: 1623. apple division --- introductory_problems/readme.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'introductory_problems/readme.md') diff --git a/introductory_problems/readme.md b/introductory_problems/readme.md index 52a1f51..32519e6 100644 --- a/introductory_problems/readme.md +++ b/introductory_problems/readme.md @@ -112,3 +112,10 @@ The goal is to move all the disks to the right stack using the middle stack. On **Input**: The only input line has an integer `n`: the number of disks. (Example: 2) **Output**: First print an integer `k`: the minimum number of moves. After this, print `k` lines that describe the moves. Each line has two integers `a` and `b`: you move a distk from stack `a` to stack `b`. (Example: 3 12 13 23) + +### Apple Division +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**: The first input line has an integer `n`: the number of apples. The next input line has `n` integers `p1, p2, ..., pn`: the weight of each apple. (Example: 5`\n`3 2 7 4 1) + +**Output**: Print one integer: the minimum difference between the weights of the groups. (Example: 1) -- cgit v1.2.3