排序从小到大累加打结就好了~~~
#include <iostream>
#include <algorithm>
#define MAX 10010
using namespace std;
int rope[MAX];
int n;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> rope[i];
}
sort(rope, rope + n);
int max = rope[0];
int link = rope[0];
bool tag = false;
for (int i = 1; i < n; i++) {
link += rope[i];
link /= 2;
}
cout << link << endl;
return 0;
}