满分代码:
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{ int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
if(a[0]>=a[n-1])
{
cout<<a[0]<<" ";
if(n%2==1)
cout<<a[n/2]<<" ";
else
{
double z=(a[n/2]+a[n/2-1])/2.0;
if(z==(int)z)
cout<<(int)z<<" ";
else
cout<<fixed<<setprecision(1)<<z<<" ";
}
cout<<a[n-1];
}
else
{
cout<<a[n-1]<<" ";
if(n%2==1)
cout<<a[n/2]<<" ";
else
{
double z=(a[n/2]+a[n/2-1])/2.0;
if(z==(int)z)
cout<<(int)z<<" ";
else
cout<<fixed<<setprecision(1)<<z<<" ";
}
cout<<a[0];
}
return 0;
}