1125 Chain the Ropes

題目大意: 兩個繩子結合成一個繩子總長度會減半,現在給你n條繩子把他們連接成一條,輸出最長的方案的長度。 解題思路: 排序,從小到大一個一個連就好了,因爲從小到大連損失的長度最少。、 代碼如下: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n,rope[
相關文章
相關標籤/搜索