思路:这道题类似合并果子不能从大到小,应当从小的开始每次选取最小的两个木板合并成新的木板,用priority_queue来做时间复杂度是o(nlogn)。
注:数据较大要开long long
代码:
Fence Repair POJ - 3253
原文:https://www.cnblogs.com/cosinehe/p/14160505.html