#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int a[100010];
int main(){
int n,maxx,minn;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
if(a[0]>a[n-1]){
maxx=a[0];
minn=a[n-1];
}
else{
maxx=a[n-1];
minn=a[0];
}
if(n%2==1){
int c=a[n/2];
cout<<maxx<<" "<<c<<" "<<minn;
}else{
int flag=0;
if((a[n/2]+a[n/2-1])%2==0)
flag=1;
float c=(a[n/2]+a[n/2-1])/2.0;
//c= round(c,1);
//cout<<"c="<<c<<endl;
if(flag)
cout<<maxx<<" "<<(a[n/2]+a[n/2-1])/2<<" "<<minn;
//这里如果是直接输出c的话会有问题,因为c是double型,然而flag判断出来的是整型
else
printf("%d %.1f %d",maxx,c,minn);
}
return 0;
}
【CCF】小中大
最新推荐文章于 2022-01-08 10:43:52 发布