为什么40分啊???

B2095 白细胞计数

jebfghbbcdsl @ 2024-08-10 09:11:16

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
double ans,a[110];int n;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%lf",&a[i]);
    sort(a+1,a+n+1);
    for(int i=2;i<n;i++)ans+=a[i];
    ans/=double(n-2.0);
    printf("%.2lf %.2lf",ans,max(ans-a[2],a[n-1]-ans));
    return 0;
}

by awa1816 @ 2024-08-10 09:51:13

cout<<"我也不道";


by chenqile @ 2024-08-10 09:51:27

(不懂就问)cstdio呢


by pmkmzfuzsotqotmzs @ 2024-08-10 09:56:24

@jebfghbbcdsl
第五行应该为:

double ans,a[301];int n;

数组开小了


by jebfghbbcdsl @ 2024-08-10 10:02:50

@chenqile iostream里包含cstdio


by jebfghbbcdsl @ 2024-08-10 10:05:59

@pmkmzfuzsotqotmzs AC了,谢谢!


by chenqile @ 2024-08-10 10:54:52


|