问题描述
试题编号: | 201903-1 |
试题名称: | 小中大 |
时间限制: | 1.0s |
内存限制: | 512.0MB |
问题描述: |
|
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, a1, a2, m;
double mid;
cin >> n >> a1;
if (n == 1) {
cout << a1 << ' ' << a1 << ' ' << a1;
return 0;
}
else if (n == 2) {
cin >> a2;
cout << max(a1,a2) << ' ' << (a1 + a2) / 2.0 << ' ' << min(a1,a2);
}
m = (n-1) / 2;
while (m--)
{
cin >> mid;
}
if (!(n % 2)) {
cin >> a2;
mid = (mid + a2) / 2.0;
}
m = (n - 1) / 2;
while (m--)
{
cin >> a2;
}
cout << max(a1, a2) << ' ' << mid<< ' ' << min(a1, a2);
return 0;
}