Introduction - If you have any usage issues, please Google them yourself
Stones merger
Problem description:
Around in a circular playground placed n heap stones. Stones are to be combined into a pile orderly. Can only be selected for each and every adjacent two reactor combined into a new pile of stones, and the new pile of stones and recorded the score for the merger. Try to design an algorithm to calculate the n combined into a pile of gravel heap minimum score and maximum score.
Programming tasks:
Heap for a given n stones, programming combined into a pile of calculating the minimum score and maximum score.
Data entry:
Line 1 is a positive integer n, 1 <= n <= 100, that there n stone heap.
There are n number of second line, respectively the number of stones per heap.
The resulting output:
Line 1 is the minimum score in a few No. 2 line number is the maximum score.
Enter
6
3456789
Export
84
125