CSP 201903-1

CSP 201903-1_第1张图片CSP 201903-1_第2张图片

#include 
#include 
#include 
using namespace std;

int main()
{
    int N;
    //freopen("d:\\a.txt","r",stdin);
    cin>>N;
    float *n=new float[N];
    for(int i=0;i<N;i++)cin>>n[i];
    long  a,b;
    float m;
    if(N==1){a=b=n[0];m=n[0];}
    else{
        if(N%2)m=n[(N+1)/2-1];else m=(n[N/2-1]+n[N/2])/2.0;
        if(n[0]<n[1]){a=n[0];b=n[N-1];}
        else {a=n[N-1];b=n[0];}
    }
     cout << b << " ";
     cout << setiosflags(ios::fixed) << setprecision(m-(int)m<0.01?0:1) << m << " " ;
     cout << a << endl;
    return 0;
}

你可能感兴趣的:(CSP 201903-1)