bdk18811723967 @ 2020-10-18 20:57:08
#include<stdio.h>
#include<string.h>
#include<math.h>
#define use _CRT_SECURE_NO_WARNINGS
int main()
{
int a[1000];
int n, temp = 0;
float sum = 0.00;
scanf("%d", &n);
if (n < 3)
{
printf("0");
return 0;
}
for (int i = 0;i < n;i++)
scanf("%d", &a[i]);
for (int i = 0;i < n;i++)
{
for (int j = 0;j < i - 1;j++)
{
if (a[j] > a[j + 1])
{
temp = a[j + 1];
a[j + 1] = a[j];
a[j] = temp;
}
}
}
for (int i = 1;i < n - 1;i++)
sum += a[i];
printf("%.2f", sum / (n - 2));
return 0;
}
by Wildcxj @ 2020-10-18 21:28:04
主页两贴,危
by mezWindows @ 2020-10-31 11:34:07
#include<algorithm>
#include<iostream>
#include<iomanip>
using namespace std;
int mmp(int a,int b){
return a>b;
}
int main(){
int n,a[1010];
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n,mmp);
double sum=0;
int kk=0;
for(int i=1;i<n-1;i++){
sum+=a[i];
kk++;
}
double ans=sum/kk;
cout<<setprecision(2)<<fixed<<ans;
return 0;
}
by mezWindows @ 2020-10-31 11:35:12
话说_CRT_SECURE_NO_WARNINGS是神马玩意
by mezWindows @ 2020-10-31 11:36:51
我的那个code可是100%AC代码!