hzyhyou @ 2020-09-10 15:27:12
#include <stdio.h>
#include <stdlib.h>
//#include <iostream>
//using namespace std;
int n;
int b[11];
int c[11]={};
double ans=0;
int main()
{
int t=0,first=0;
int m;
scanf ("%d",&n);
for (int i=0; i<=10; i++)
b[i]=10001;
for ( int i = 1; i <= n; i++)
{
scanf ("%d",&m);
if (c[m]==0)
{
c[m]=1;
b[m]=0;
}
if (c[m]==1)
b[m]++;
}
for ( int i=0; i<=10; i++)
{
if (b[i]!=10001&&first==0)
{
first=1;
b[i]=b[i]-1;
break;
}
}
first=0;
for ( int i=10; i>=0; i--)
{
if (b[i]!=10001&&first==0)
{
first=1;
b[i]=b[i]-1;
break;
}
}
for (int i=0; i<=10; i++)
{
if(b[i]!=10001) t=t+i*b[i];
}
ans=t*1.00/(n-2);
printf("%.2lf",ans);
return 0;
}
by fresh_boy @ 2020-09-10 15:34:16
@hzyhyou 你12ms比他们慢了???
by dead_X @ 2020-09-10 15:43:52
@hzyhyou 几毫秒时间不重要。。。你去看看Ynoi的最优解争夺,那才是神仙打架
by DOCTYPE_OIers @ 2020-09-10 16:07:26
@hzyhyou 几毫秒时间不重要,甚至有可能只是评测机性能波动
by hzyhyou @ 2020-09-10 17:52:56
谢谢各位老师解答!