杭电ACM 2014

#include<stdio.h>

int
main()
{

    int
i,n,a[100],max,min;
    double
av,sum;

    while
(scanf("%d",&n)!=EOF)
    {

         for
(i=0;i<n;i++)
        {

            scanf("%d",&a[i]);
        }


        sum=0.0;
        max=a[0];
        min=a[0];


        for
(i=0;i<n;i++)
        {

            if
(a[i]>max)
            {

                max=a[i];
            }

            if
(a[i]<min)
            {

                min=a[i];
           
            }

       
            sum+=a[i];
        }

        av=((sum-max-min)/(n-2));
       
      

           printf("%.2f\n",av);
       
   
    }

   

    return
0;
}

posted on 2013-03-16 17:02  facetosea  阅读(195)  评论(0编辑  收藏  举报

导航