0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 17:32:00 +00:00

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

R38743182
This commit is contained in:
Baoshuo Ren 2020-09-22 20:23:46 +08:00 committed by Baoshuo Ren
parent a30ae101e2
commit 1d766c6c20
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

42
problem/P5738/P5738.cpp Normal file
View File

@ -0,0 +1,42 @@
// R38743182
#include <bits/stdc++.h>
using namespace std;
struct node {
int score[22];
double sum, all;
node() {
memset(this->score, 0x00, sizeof(this->score));
all = sum = 0.00;
}
void t(int m) {
for (int i = 0; i < m; i++) {
cin >> score[i];
}
std::sort(score, score + m);
for (int i = 1; i + 1 < m; i++) {
sum += score[i];
}
all = sum / (m - 2.00);
}
};
bool cmp(node a, node b) {
return a.all > b.all;
}
int main() {
int n, m;
node student[105];
cin >> n >> m;
for (int i = 0; i < n; i++) {
student[i].t(m);
}
sort(student, student + n, cmp);
printf("%.2lf", student[0].all);
return 0;
}