大佬们来看看,#1#2没过,60分,能解疑一下为什么吗
查看原帖
大佬们来看看,#1#2没过,60分,能解疑一下为什么吗
998911
muausees楼主2023/5/10 18:08

代码:

#include <bits/stdc++.h>

using namespace std;

struct stu {
	int inpoi[20];
	double point;
	void outpoi(int m){
		double temp = 0;
		for(int i = 0; i < 20; i++){
			temp += inpoi[i];
		}
		temp = temp - *max_element(inpoi, inpoi + m);
		temp = temp - *min_element(inpoi, inpoi + m);
		temp /= m - 2;
		point = temp;
	}
};

stu st[100];

int main(int argc, char** argv) {
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
	int n,m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> st[i].inpoi[j];
		}
	}
	for(int i = 0; i < n; i++){
		st[i].outpoi(m);
	}
	double out = max(st[0].point, st[n].point);
	printf("%.2lf", out);
	return 0;
}
2023/5/10 18:08
加载中...