萌新求助!!

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

@[tslover22](/user/182650) 最大最小减了n次
by Temperature_automata @ 2021-03-09 21:00:21


你第一重for直接到了return 0
by Temperature_automata @ 2021-03-09 21:01:04


(这什么鬼码风
by Temperature_automata @ 2021-03-09 21:01:36


最大最小的我改了, 第二个直接return 0也改了 不过现在还是不能有正确的输出 谢谢大佬
by tslover22 @ 2021-03-09 21:13:48


@[tslover22](/user/182650) 代码再贴一下
by Temperature_automata @ 2021-03-09 21:25:05


@[天启混沌之眼](/user/316827) ```c #include<stdio.h> #include<math.h> int main() { int a, b; scanf("%d %d", &a, &b); int n[101][21]; double s[101] = {0}; int max[101] = {0}; int min[101] = {0}; double c; for (int i = 1; i <= a; i++) { for (int j = 1; j <= b; i++) { scanf("%d", &n[i][j]); if (max[i] < n[i][j]) { //求出最大最小值 max[i] = n[i][j]; } if (min[i] > n[i][j]) { min[i] = n[i][j]; } s[i] = s[i] + n[i][j]; //每一行的总和等于加起来所有数 } s[i] = (s[i]-max[i] - min[i]) / (b - 2); //个人所得分数 double c = s[1]; if (c <= s[i]) { //求出最大 c = s[i]; } } printf("%0.2lf", c); return 0; } ```
by tslover22 @ 2021-03-10 10:30:07


@[tslover22](/user/182650) double c=s[1]那行去掉,上面定义时double c = -1
by Temperature_automata @ 2021-03-10 12:31:25


|