题很简单,当时自己写完,21分,所有特殊情况也都想到了
最后看题解,发现是理解错误,我理解是四舍五入,正确是向下取整
emmm
The result must be rounded to the nearest integer that is no greater than the maximum length.
迷惑
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
int n;
vector<int> ans;
int sum;
int main()
{
cin >> n;
for(int i=0; i<n; i++){
int a;
cin >> a;
ans.push_back(a);
}
sort(ans.begin(),ans.end());
sum = (ans[0]+ans[1])/2;
for(int i=2; i<n; i++){
sum = (ans[i]+sum)/2;
}
cout << sum << endl;
return 0;
}