哈夫曼树的模板题
实质其实是贪心法

#include<bits/stdc++.h>
#include<queue>
using namespace std;
const int maxn = 1e4+10;
int main(){
	int N;
	float arr[maxn];
	memset(arr,0,sizeof(arr));
	priority_queue<int, vector<int>,greater<int> > q;
	while(!q.empty()){
		q.pop();
	} 
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%f",&arr[i]);
		q.push(arr[i]);
	}

	while(q.size()>1){
		int a= q.top();
		q.pop();
		int b= q.top();
		q.pop();
		q.push((a+b)/2);
	}
	printf("%d\n",int(q.top()));
	return 0;
}