ccf 201903-1
#include <stdio.h> #include <algorithm> #include <string.h> #define MAX 100005 using namespace std; int main(){ int n, mid; int s[MAX]; bool flag; float mid_; while(scanf("%d",&n)!=EOF){ memset(s,0,sizeof(s)); for(int i=1; i<=n; i++) scanf("%d",&s[i]); sort(s+1, s+n+1); int max_=s[n]; int min_=s[1]; flag =true; if(n%2==0){ if((s[n/2] + s[n/2+1])%2==0) mid=(s[n/2] + s[n/2+1]) / 2; else{ flag =false; mid_= s[n/2] + s[n/2+1]; mid_/=2; } } else mid=s[n/2+1]; if(!flag) printf("%d %.1f %d\n",max_,mid_,min_); else printf("%d %d %d\n",max_, mid,min_); } return 0; }