没问题啊,只不过T了嘛
by Miss_SGT @ 2024-09-21 21:02:10
你提交那份有一句没加;
by Miss_SGT @ 2024-09-21 21:02:47
@[Miss_SGT](/user/705012)
不对,仔细注意程序的 `14` 行:
`if(a[j<min])`
`j<min` 被包在中括号里了。
by DDD_et @ 2024-09-21 21:03:54
@[Lilindong](/user/1404467)
还有第21行:
`if(b[k]==0)`
不应该是 `if(b[a[k]]==0)` 吗?
by DDD_et @ 2024-09-21 21:06:32
@[DDD_et](/user/1205074) 可是他问的不是编译问题吗,这份代码能过编译啊
by Miss_SGT @ 2024-09-21 21:07:41
@[Miss_SGT](/user/705012)
呃……那倒是……(对不起)
~~尴尬~~
就当好心人顺便纠个错吧
by DDD_et @ 2024-09-21 21:09:05
@[DDD_et](/user/1205074) 我甚至没看他写的什么 ovo
by Miss_SGT @ 2024-09-21 21:10:33
@[Miss_SGT](/user/705012)
好吧……
by DDD_et @ 2024-09-21 21:11:57
改了之后有结果了但只要40分,大佬能不能看看问题在哪里
```
#include <stdio.h>
#include <limits.h>
#include <math.h>
int fen(int x) {
int i, max = INT_MIN, min = INT_MAX, sum = 0;
int a[21];
for (i = 0; i < x; i++)
scanf("%d", &a[i]);
for (i = 0; i < x; i++) {
if (a[i] > max)
max = a[i];
if (a[i] < min)
min = a[i];
}
for (i = 0; i < x; i++) {
if (a[i] != max && a[i] != min)
sum += a[i];
}
return sum;
}
int main() {
int m, n, i;
double an, max = 0;
scanf("%d%d", &m, &n);
for (i = 0; i < m; i++) {
an = fen(n);
if (an > max)
max = an;
}
an = max * 1.0 / (1.0 * (n - 2));
printf("%.2lf", an);
return 0;
}
```
by Lilindong @ 2024-09-22 12:11:02
@[Lilindong](/user/1404467) 可能是有相同的数,你的代码就会少算,比如某个人的评分是 $1,1,2,2$,和应为 3,实际上你会算出 0。
by Miss_SGT @ 2024-09-23 14:38:26