1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include<iostream> #include<iomanip> #include<cstring> using namespace std; int main(){ int n,m,highflag,lowflag,i,o; float score[100][20],highest,totalscore=0.00,pingjun[20]={0.00};
cin>>n>>m; for(i=1;i<=n;i++){ for(o=1;o<=m;o++){ cin>>score[i][o]; } } for(i=1;i<=n;i++){ highflag=1; lowflag=1; for(o=1;o<=m;o++){ if(score[i][highflag]<score[i][o]){ highflag=o; } if(score[i][lowflag]>score[i][o]){ lowflag=o; } } score[i][highflag]=0; score[i][lowflag]=0; for(o=1;o<=m;o++){ totalscore+=score[i][o]; } pingjun[i]=totalscore/(m-2); totalscore=0; } highest=pingjun[1]; for(i=1;i<=n;i++){ if(pingjun[i]>highest){ highest=pingjun[i]; } } cout<<fixed<<setprecision(2)<<highest<<endl; return 0; }
|