解题思路:安装题目要求即可,最后注意输出格式
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,index;
int sum,score,tscore,max,min;
cin>>n>>m;
for(int i=1;i<=n;i++){
sum=0;
index=0;
max=-1;
min=100;
cin>>tscore;
for(int j=2;j<=n;j++){
cin>>score;
if(score<=m&&score>=0){
index++;
sum+=score;
if(score>max)
max=score;
if(score<min)
min=score;
}
}
cout << int((((sum - min - max) * 1.0 / (index-2)) + tscore) / 2 + 0.5) << endl;
}
}
运行结果:![](https://i-blog.csdnimg.cn/blog_migrate/9f3e0a2133594e967334b67cb483d70b.png)