HDU/2014/main.c

27 lines
597 B
C
Raw Normal View History

2020-08-31 16:48:58 +00:00
#include <stdio.h>
int main(void){
int numbers = 0;
while(scanf("%d",&numbers) == 1){
int count = 0, temp[120] = {0}, max = 0, min = 0;
double avg = 0.0;
while(count < numbers){
scanf("%d",&temp[count]);
if(!count){
max = temp[count];
min = temp[count];
}
else{
if(max < temp[count]) max = temp[count];
if(min > temp[count]) min = temp[count];
}
count++;
}
for(count = 0; count < numbers; count++)
if(temp[count] != max && temp[count] != min) avg += (double)temp[count] / (double)(numbers-2);
printf("%.2lf\n",avg);
getchar();
}
return 0;
}