大佬们可以帮忙看看为什么只有六十分吗

P5726 【深基4.习9】打分

qxxxxxxxxxxx @ 2024-10-19 23:39:00


#include<stdio.h>
int main(){
    float x,y,z,min,max;
    scanf("%f\n",&x);
    scanf("%f",&y);
    min=y;
    max=y;
    z=y;
    for(int i=1;i<a;i++){
        scanf("%f",&y);
        z=z+y;
        if(min>=y){
            min=y;
        }
        else{
            max=y;
        }
    }
    z=z-min-max;
    z/=(a-2);
    printf("%.2f",z);
    return 0;
}

by linzhihan16 @ 2024-10-20 16:22:23

第9行,应该是i<=a


by linzhihan16 @ 2024-10-20 16:24:56

搞错了,应该Max=y也要判断,不然就不是最大值


by qxxxxxxxxxxx @ 2024-10-20 23:34:36

@linzhihan16 OK谢谢大佬


|