1671
注意:要审题,英语是从大到小不是小到大,别的没啥好说的,结构体+sort完事
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
#include<stdlib.h>
using namespace std;
typedef long long ll;
const int maxn=100008;
const int mod=998244353;
const int inf=0x3f3f3f3f;
char a[maxn];
struct sc{
int math,chinese,english;
double ave;
}s[maxn];
bool cmp(sc a,sc b){
if(a.ave!=b.ave)
return a.ave>b.ave;
else {
if(a.math==b.math){
if(a.chinese==b.chinese)
return a.english<b.english;
else return a.chinese>b.chinese;
}
else return a.math>b.math;
}
}
int main()
{
int n,sum;
while(~scanf("%d",&n)){
sum=0;
for(int i=0;i<n;i++){
scanf("%d%d%d",&s[i].math,&s[i].english,&s[i].chinese);
s[i].ave=(s[i].chinese+s[i].math+s[i].english)/3.0;
}
sort(s,s+n,cmp);
for(int i=0;i<n;i++)
printf("%d %d %d %.2lf\n",s[i].math,s[i].chinese,s[i].english,s[i].ave);
}
return 0;
}