# 蒟蒻求助，WA了两个点。

@acwing_cht  2020-09-05 20:41 回复

RT，WA两个点

#include<bits/stdc++.h>
using namespace std;
int n, m;
int alls[110][110];
double p[110];
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
cin >> alls[i][j];
//去掉最低分
for(int i = 1; i <= n; i ++)
{
int MIN = 999999999, MAX = 0, minid = 0, maxid = 0;
for(int j = 1; j <= m; j ++)
{
if(alls[i][j] < MIN) MIN = alls[i][j], minid = j;
if(alls[i][j] > MAX) MAX = alls[i][j], maxid = j;
}
alls[i][minid] = 0;
alls[i][maxid] = 0;
}

//算出平均分
for(int i = 1; i <= n; i ++)
{
int sum = 0;
for(int j = 1; j <= m; j ++) sum += alls[i][j];
p[i] = sum / (m - 2) * 1.0;
}
double maxn = 0;
for(int i = 1; i <= n; i ++) maxn = max(maxn, p[i]);
printf("%.2lf\n", maxn);
return 0;
} 
@步凡 2020-09-05 20:47 回复 举报

@我爱Chtholly 说话要有礼貌，不要显得你什么都知道

@超级玛丽王子  2020-09-05 20:50 回复 举报

@步凡 sorry我注意 另外：


conio=console input and output

stdint=standard integer processing

bits/basic_string=字面意思 基本字符串类型
@步凡 2020-09-05 20:51 回复 举报

for(int i = 1; i <= n; i ++)
{
int MIN = 999999999, MAX = 0, minid = 0, maxid = 0;
for(int j = 1; j <= m; j ++)
{
if(alls[i][j] < MIN) MIN = alls[i][j], minid = j;
if(alls[i][j] > MAX) MAX = alls[i][j], maxid = j;
}
alls[i][minid] = 0;
alls[i][maxid] = 0;
}   

@acwing_cht  2020-09-05 20:52 回复 举报

@步凡 额，那就是这样？

#include<bits/stdc++.h>
using namespace std;
int n, m;
int alls[110][110];
double p[110];
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
cin >> alls[i][j];
//去掉最低分
int MIN = 999999999, MAX = 0, minid = 0, maxid = 0;
for(int i = 1; i <= n; i ++)
{
MIN = 999999999, MAX = 0, minid = 0, maxid = 0;
for(int j = 1; j <= m; j ++)
{
if(alls[i][j] < MIN) MIN = alls[i][j], minid = j;
if(alls[i][j] > MAX) MAX = alls[i][j], maxid = j;
}
alls[i][minid] = 0;
alls[i][maxid] = 0;
}

//算出平均分
for(int i = 1; i <= n; i ++)
{
int sum = 0;
for(int j = 1; j <= m; j ++) sum += alls[i][j];
p[i] = sum / (m - 2) * 1.0;
}
double maxn = 0;
for(int i = 1; i <= n; i ++) maxn = max(maxn, p[i]);
printf("%.2lf\n", maxn);
return 0;
} `