2020-11-13

impJ發表於2020-11-21

#include<stdio.h>
#include<stdlib.h>
int comp (const void _a, const void _b){ int a=(int)_a; int* b=(int*)_b; return *a-*b;}int main(){ int n,i,sum=0; scanf("%d",&n); int a[n]; for(i=0;i<n;i++) scanf("%d",a[i]); qsort(a,n,sizeof(a[0]),comp); for(i=1;i<n-1;i++) sum=sum+a[i]; printf("%.2f",(float)sum/(n-2)); return 0; }