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

题目传送门

#include <bits/stdc++.h>

using namespace std;
const int N = 110;
int n, m;
int a[N];
double Max = -1;

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) cin >> a[j];
        sort(a + 1, a + 1 + m);
        double sum = 0;
        for (int j = 2; j <= m - 1; j++) sum += a[j];
        Max = max(Max, sum / (m - 2));
    }
    printf("%.2lf", Max);
    return 0;
}
posted @ 2021-11-19 09:02  糖豆爸爸  阅读(122)  评论(0)    收藏  举报
Live2D