水题
#include <iostream>
using namespace std;
int n;
int Max, Min, Middle;
double Middle1;
int main() {
scanf("%d",&n);
int arr[n];
for(int i = 0; i < n; ++i) {
scanf("%d",&arr[i]);
}
Max = arr[0];
Min = arr[n-1];
if(Max < Min) {
Max = arr[n-1];
Min = arr[0];
}
if(n % 2 == 0) {
if((arr[n/2-1] + arr[n/2]) % 2 == 0){
Middle = (arr[n/2-1] + arr[n/2]) / 2;
printf("%d %d %d",Max,Middle,Min);
} else {
Middle1 = (arr[n/2-1] + arr[n/2]) / 2.0;
//.1f 用来四舍五入保留小数点后一位
printf("%d %.1f %d",Max,Middle1,Min);
}
}
else {
Middle = arr[n/2];
printf("%d %d %d",Max,Middle,Min);
}
return 0;
}