只得了40分,求大佬帮助,c语言编译

P5738 【深基7.例4】歌唱比赛

``` b[i] = (sum - min - max) / (m-2);``` 这个分数线左右都加一个/1.000(建议括起来),或者所有变量都设成```double```型试试
by miaojintao @ 2021-11-14 14:56:14


``` for( i = 0; i < n; i++) { for( j = 0; j < m; j++) { if(max < a[i][j]) max =a[i][j]; if(min > a[i][j]) min = a[i][j]; sum += a[i][j]; } b[i] = (sum - min - max) / (m-2); max = 0; min = 0; sum = 0; } ``` 这段代码中,将min=0改为min=100000 可能卡精度,将float改为double ~~干啥啥不行,只会调水题~~
by _Vector_ @ 2021-11-14 15:01:16


int max=a[0][0]; int min=a[0][0]; int sum=0; for( i = 0; i < n; i++) { for( j = 0; j < m; j++) { if(max < a[i][j]) max =a[i][j]; if(min > a[i][j]) min = a[i][j]; sum += a[i][j]; } b[i] = (sum - min - max) / (m-2); max = 0; min = 0; sum = 0; } 可以改成 int max,min,sum; for (int i = 0; i < n; i++) { max = a[i][0]; min = a[i][0]; sum = 0; for (int j = 0; j < m; j++) { if (max < a[i][j]) max = a[i][j]; if (min > a[i][j]) min = a[i][j]; sum = sum + a[i][j]; } b[i] = ((sum - min - max) / 1.000) / ((m - 2) / 1.000); } 每次max与min不应该是[0][0]而应该是[i][0]
by zjy2121 @ 2021-12-25 21:38:03


|