asm666 @ 2024-05-24 23:04:38
#include<bits/stdc++.h>
using namespace std;
int n,a[1000],s;
float b;
int main()
{
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
for(int i=1;i<n-1;i++){
s+=a[i];
}
n=n-2;
printf("%0.2f",s/n);
return 0;
}
by KY_ABC @ 2024-05-25 07:50:55
@asm666
#include <iostream>
using namespace std;
int main(){
double a,b,c,d,e;
c = 10000;
d = 0;
cin>>a;
for (int i = 1;i<=a;i++){
cin>>b;
e+=b;
if (b<c){
c = b;
}
if (b>d){
d = b;
}
}
printf("%0.2f",(e-c-d)/(a-2));
return 0;
}
by TimADE @ 2024-05-25 11:26:47
@asm666 []()```cpp
using namespace std; int main(){ int n,p=-1000000,r=1000000,sum=0; cin>>n; for(int i=0;i<n;i++){ int x; cin>>x; if(x>p) p=x; if(x<r) r=x; sum+=x; } cout<<fixed<<setprecision(2)<<((1.0*sum)-p-r)/(n-2); return 0; }
by asm666 @ 2024-05-25 19:29:18
@TimADE 大佬请问为什么我的输出永远是0.00啊,我感觉没什么问题啊,,,
by TimADE @ 2024-05-25 20:56:59
@asm666 printf("%0.2f",s*1.0/n);就行了。