# 六十分代码求助。。。。

@wwwchen 2020-05-01 20:08 回复
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int bb = -1000;
for(int i = 0; i < n; i++) {
int b = -1000, s = 1000;
double sum = 0;
for(int j = 0; j < m; j++) {
int t;
cin >> t;
if(t > b) {
b = t;
}
if(t < s) {
s = t;
}
sum += t;
}
sum = sum - b - s;
sum = 1.0*sum/(m-2);
if(sum > bb) {
bb = sum;
}
}
cout << fixed << setprecision(2) << 1.0*bb << endl;
return 0;
}


@Starlit_Night 2020-05-01 20:09 回复 举报
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
//#include <bits/stdc++.h>
#define MAXN 210000000
#define MINN -210000000
using namespace std;
typedef long long ll;
int n,m,maxx=0,sum;
int a[102];
double ave;
int main(){
cin>>n>>m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[j];
}
sort(a,a+m);
for(int j=1;j<m-1;j++){
sum+=a[j];
}
maxx=max(maxx,sum);
sum=0;
}
ave=(double)maxx/(m-2);
printf("%.2f",ave);
return 0;
}


@W_churchill 2020-05-01 20:10 回复 举报
#include<bits/stdc++.h>
using namespace std;
int maxn,minn=100000;
double zf;
int a[10001];
int main()
{
int n,m;
cin>>n>>m;
double maxnn=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>a[j];
maxn=max(maxn,a[j]);
minn=min(minn,a[j]);
zf+=a[j];
}
zf=zf-minn-maxn;
zf=zf/((m-2)*1.0);
maxnn=max(maxnn,zf);
maxn=0;
minn=100000;
zf=0;
}
cout<<fixed<<setprecision(2)<<maxnn<<endl;
return 0;
}