救救救救救

P5726 【深基4.习9】打分

zhangruihan66 @ 2023-02-11 21:53:12

#include <bits/stdc++.h>
using namespace std;
int main(){
    int a[1000],n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i-1];
    }
    sort(a,a+n-1);
    double sum=0;
    for(int i=1;i<n-1;i++){
        sum+=a[i];
    }
    double ans=sum/(n-2);
    cout<<fixed<<setprecision(2)<<ans;
    return 0;
} 

啊啊60分,1、3两个点过不去


by jiangjiangQwQ @ 2023-02-11 21:55:55

sort(a,a+n-1);

sort(a,a+n);

就可以AC了


by jiangjiangQwQ @ 2023-02-11 21:56:13

@zhangruihan66


by zhangruihan66 @ 2023-02-11 22:13:09

哦哦好滴,谢谢大佬


by zhangruihan66 @ 2023-02-11 22:14:23

终于过了


|