草稿
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef struct
{
char name[20];
double score[4];
}Stu;
int cmp(Stu a,Stu b)
{
return a.score[3]>b.score[3];
}
int main()
{
Stu students[50];
for(int i=0;i<50;i++)
{
scanf("%s%lf%lf%lf",students[i].name,&students[i].score[0],&students[i].score[1],&students[i].score[2]);
students[i].score[3]=students[i].score[0]+students[i].score[1]+students[i].score[2];
}
sort(students,students+50,cmp);
for(int i=0;i<50;i++)
{
printf("%s %lf %lf %lf %lf\n",students[i].name,students[i].score[0],students[i].score[1],students[i].score[2],students[i].score[3]);
}
return 0;
}