#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int num[n];
for(int i = 0; i < n; i++){
cin >> num[i];
}
if(num[0] >= num[n - 1]){
cout << num[0] << " ";
if(n % 2 == 1){
cout << num[n / 2];
}else{
double mid = (num[n / 2] + num[n / 2 - 1]) / 2.0;
if(mid == floor(mid)){
cout << mid;
}else{
cout << fixed << setprecision(1) << mid;
}
}
cout << " " << num[n - 1] << endl;
}else{
cout << num[n - 1] << " ";
if(n % 2 == 1){
cout << num[n / 2];
}else{
double mid = (num[n / 2] + num[n / 2 - 1]) / 2.0;
if(mid == floor(mid)){
cout << mid;
}else{
cout << fixed << setprecision(1) << mid;
}
}
cout << " " << num[0] << endl;
}
return 0;
}
不保证完全通过,仅测试了样例。