求助!C语言只有第一个测试点对了

P5726 【深基4.习9】打分

FreshLittleLemon @ 2023-08-14 11:48:01

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,i,max=0,min=10,sum=0;
    double ave;
    int* a=(int *)malloc(n*sizeof(int));
    scanf("%d",&n);
    for (i=0;i<n;i++) {
        scanf("%d",&a[i]);
        if (a[i]>max) {
            max=a[i];
        }
        if (a[i]<min) {
            min=a[i];
        }
        sum+=a[i];
    }
    ave=1.0*(sum-max-min)/(n-2);
    printf("%.2lf",ave);
}

这到底是为什么嘞


by szh_AK_all @ 2023-08-14 12:03:32

int a[1005] 就行了


by IkunFriendsChat @ 2023-08-14 13:59:30

660000!以后这里会遍布考古人员足迹!


by Rieman_sum @ 2023-08-14 14:26:13

先占一排


by ZZQF5677 @ 2023-08-14 18:03:02

考古


by sapo1o @ 2023-08-15 08:56:07

qp


by 李翊辰2012 @ 2023-08-15 15:45:35

提前烤谷


by FreshLittleLemon @ 2023-08-15 17:06:09

@IronRoosterIkun 啊?为什么是考古(不懂


by FreshLittleLemon @ 2023-08-15 17:08:04

我傻了

 scanf("%d",&n);

得写在malloc前


by linzhanjing @ 2023-08-17 10:34:00

qp


by _8008008 @ 2023-08-19 20:44:01

qp


| 下一页