AOY616 @ 2023-08-10 14:45:53
#include<stdio.h>
int main()
{
int n;//n个评委
scanf("%d",&n);
int a[1000];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int p=n;
for(int i=0;i<n;i++)
{
for(int j=0;j<p-1;j++)
{
if(a[i]>a[i+1])
{
int temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
p--;
}
int sum=0;
for(int i=1;i<n-1;i++)
{
sum+=a[i];
}
double value;
value=sum*1.0/(n-2);
printf("%.2lf",value);
}
by lujunxuan123 @ 2023-08-10 14:52:23
@AOY616 冒泡排序里的j写成i了
by AOY616 @ 2023-08-10 14:53:04
@lujunxuan123 感谢大佬,好粗心啊
by AOY616 @ 2023-08-10 14:53:36
已解决