求助,只过一个点

P5726 【深基4.习9】打分

Li_mz__ @ 2022-10-18 17:56:19

论我为什么这么简单的题还要问人

#include <bits/stdc++.h>

using namespace std;
int main(){
    int n;
    int arr[1005];
    cin>>n;
    for(int i = 0;i < n;i++){
        cin>>arr[i];
    }
    sort(arr,arr + 1);
    double ans = 0;
    for(int i = 1;i < n - 1;i++){
        ans += arr[i];
    }
    n -= 2;
    printf("%.2lf",ans / n);
    return 0;
} 

看着挺合理的啊


by Li_mz__ @ 2022-10-18 17:57:21

我还拿计算器算了一遍诶

就是过不了


by ImposterAnYu @ 2022-10-18 17:58:24

@Li_mz__

    sort(arr,arr + 1);

《挺合理》


by jijidawang @ 2022-10-18 17:58:48

高手写法

sort(arr,arr + 1);

by Li_mz__ @ 2022-10-18 18:00:31

@owo_ImposterAnYu_owo

What's up


by Li_mz__ @ 2022-10-18 18:01:20

@owo_ImposterAnYu_owo

为啥?

那咋写?


by ImposterAnYu @ 2022-10-18 18:02:29

@Li_mz__ 改成

    sort(arr,arr + n);

by tamamocross @ 2022-10-18 18:02:31

sort是不是不太对(


by Li_mz__ @ 2022-10-18 18:03:31

@owo_ImposterAnYu_owo 谢谢大佬


by Katz @ 2022-10-18 18:03:44

啊这


by Li_mz__ @ 2022-10-18 18:04:29

@owo_ImposterAnYu_owo 过了, 谢谢


|