#P2090. Stone Game
Stone Game
题目描述
点击这里查看pdf
MianKing has piles of stones and each pile has at most stones, now he wants to merge all of these stones into one pile.
In order to achieve his goal, each time MianKing can choose two piles of stones and merge them into a new pile, and the number of stones in the new pile is the sum of these two piles.
Because it takes manpower to move stones, in each operation if the numbers of these two piles of stones are and respectively, MianKing should pay coins for it.
Now MianKing wants to know the minimum amount of coins he need to pay to merge all of these stones into one pile.
输入格式
The first line has integers . And denotes the number of piles which have stones.
输出格式
Output one integer: the minimum amount of coins MianKing need to pay for his goal.
样例
1 1 1
2
99 66 55
165
提示
Form 2020ICPC济南站