CCF认证 201903-1 小中大
作者:互联网
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10;
int A[maxn];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&A[i]);
if(A[0]<A[n-1]) swap(A[0],A[n-1]);
printf("%d ",A[0]);
if(n%2){
printf("%d",A[n/2]);
}
else{
if((A[n/2]+A[n/2-1])%2==0)
printf("%d",(A[n/2]+A[n/2-1])/2);
else
printf("%.1f",(double)(A[n/2]+A[n/2-1])/2.0);
}
printf(" %d",A[n-1]);
return 0;
}
标签:std,10,include,小中大,int,maxn,201903,CCF 来源: https://blog.csdn.net/qq_40597059/article/details/102731106