AcWing 3272. 小中大
原题链接
简单
作者:
Value
,
2021-04-09 23:42:05
,
所有人可见
,
阅读 662
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const int N = 1E5 + 10;
int a[N];
int main(){
int n; cin >> n;
for(int i = 0; i < n; i ++ ) scanf("%d", &a[i]);
sort(a, a + n);
double mid;
if(n % 2 == 0) mid = (a[n / 2] + a[n / 2 - 1]) / 2.0;
else mid = a[n / 2];
if(abs(mid - int(mid)) < 1e-5) printf("%d %d %d", a[n - 1], int(mid), a[0]);
else printf("%d %.1lf %d", a[n - 1], mid, a[0]);
return 0;
}