Oct-01-2020, 12:26 PM
A list is given. You know the number of sticks with which we divide our list into subsets. The rules of division is that the sum of elements in each part should be approximately the same(so that the mininum sum of elements would be as big as possible). Then the programm should print the minimum of that sums.
For example:
Input:
4 (is a number of sticks) (so the list would be divided into three parts)
2 4 4 5 5 8 (the list itself)
Output:
8
Explanation: first we put stick before the first element, another stick at the end of the list(after 8). Then third stick between 4 and 5 , and the fourth between 5 and 8.
Can't think of an algorithm that would perform that task .
For example:
Input:
4 (is a number of sticks) (so the list would be divided into three parts)
2 4 4 5 5 8 (the list itself)
Output:
8
Explanation: first we put stick before the first element, another stick at the end of the list(after 8). Then third stick between 4 and 5 , and the fourth between 5 and 8.
Can't think of an algorithm that would perform that task .