#K45602. Minimum Difference Between Team Scores
Minimum Difference Between Team Scores
Minimum Difference Between Team Scores
You are given an array of integers where each element represents the score of a player in a game. Your task is to partition the players into two teams such that the absolute difference between the total scores of the two teams is minimized.
Note: Each player's score is positive and the number of players can be up to 100. Use dynamic programming to find a subset of players whose total score is as close as possible to half the overall sum.
Formula: Given total sum \(S\) and one team with score \(s\), the answer is \(|S - 2s|\).
inputFormat
The first line contains an integer \(n\) (\(1 \leq n \leq 100\)), the number of players.
The second line contains \(n\) space-separated integers denoting the scores of the players where each score is between 1 and 100.
outputFormat
Output a single integer, the minimum possible absolute difference between the total scores of the two teams.
## sample5
1 2 3 4 5
1
</p>