CCF 201903-1 小中大

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define mem(a,b) memset(a,b,sizeof(a));
using namespace std;
typedef long long ll;
const int maxn = 500005;
const ll INF = 0x3f3f3f3f;

int main()
{
    int n;
    int a[100005];
    scanf("%d",&n);
    for(int i = 1; i <= n; i++) {
            scanf("%d",&a[i]);
    }
    sort(a+1,a+1+n);
    int mmin = a[1], maxn = a[n];
    double mid;
    if(n % 2 == 0) {
         mid = (a[n/2+1]+a[n/2])*1.0/2;
    }
    else {
        mid = a[n/2+1];
    }
    if(mid == (int)mid) printf("%d %.0lf %d\n",maxn,mid,mmin);
    else printf("%d %.1lf %d\n",maxn,mid,mmin);
    return 0;
}

注意输出格式

posted on 2019-08-10 21:53  一只小毛球  阅读(273)  评论(0编辑  收藏  举报

导航