很简单的题,代码如下:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
vector<int> vec;
for(int i=0;i<n;i++){
int x;
cin>>x;
vec.push_back(x);
}
sort(vec.begin(),vec.end());
int flag=0;
if(n%2==1)flag=1;
int mid;
if(flag){mid=vec[n/2];cout<<vec[n-1]<<" "<<mid<<" "<<vec[0];}
else if((vec[n/2]+vec[n/2-1])%2==0){mid=(vec[n/2]+vec[n/2-1])/2;cout<<vec[n-1]<<" "<<mid<<" "<<vec[0];}
else {
printf("%d %.1f %d",vec[n-1],((float)(vec[n/2]+vec[n/2-1])/2),vec[0]);
}
}