1125 Chain the Ropes

题目大意: 两个绳子结合成一个绳子总长度会减半,现在给你n条绳子把他们连接成一条,输出最长的方案的长度。 解题思路: 排序,从小到大一个一个连就好了,因为从小到大连损失的长度最少。、 代码如下: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n,rope[
相关文章
相关标签/搜索