You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
342 B
C++

#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;
int a[100];
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
scanf("%d",a+i);
printf("%.2lf\n",(accumulate(a,a+n,0)-*max_element(a,a+n)-*min_element(a,a+n))/(n-2.00));
}
return 0;
}