[恢]hdu 2014
2011-12-12 05:46:08
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2014
题意:中文题。
mark:wa了3次!!!因为敲错变量!!!min敲成了num,各种二。可能是困了。
代码:
# include <stdio.h>
# define MAX(a,b) (a>b?a:b)
# define MIN(a,b) (a<b?a:b)
int main ()
{
int sum, max, min, num ;
int n, i ;
while (~scanf ("%d", &n))
{
scanf ("%d", &num) ;
sum = min = max = num ;
for (i = 1 ;i < n; i++)
{
scanf ("%d", &num) ;
max = MAX(max, num) ;
min = MIN(min, num) ;
sum += num ;
}
printf ("%.2lf\n", (double)(sum-max-min)/(n-2)) ;
}
return 0 ;
}