//试题名称 考试排名
//时间限制: 1 秒
//内存限制: 256KB
//
//问题描述
//某考试有5道题和1道附加题,每题最高得分20分,总分计算为所有题目分数之和。给出一组考生的数据,对其按照总分从高到低进行排名,总分相同时按附加题得分高者优先。
//
//输入说明
//第一行为一个整数N,表示考生个数(N小于100),后面N行为考生数据,每行包含考生姓名(长度不超过20个字符)以及6个以空格分隔的整数,分别表示第一题到第五题以及附加题的得分(最后一项)。
//
//输出说明
//输出排序结果,每行为一个考生的姓名、总分、附加题得分,以空格分开。
//
//输入样例
//3
//Jony 18 20 20 20 20 20
//Kavin 20 20 20 20 20 18
//Kaku 15 15 15 15 15 15
//
//输出样例
//Jony 118 20?
//Kavin 118 18?
//Kaku 90 15
#include<stdio.h>
#include<string.h>
struct Student
{
int n;
char name[100][20];
int a[100][6];
int sum[100];
}score;
int main()
{
int i,j;
struct Student score=
{
0,{
'\0'},{
0},{
0}
};
scanf("%d",&score.n);
for(i=0;i<score.n;i++)
{
scanf("%s",&score.name[i]);
for(j=0;j<6;j++)
{
scanf("%d",&score.a[i][j]);
}
}
for(i=0;i<score.n;i++)
for(j=0;j<6;j++)
{
score.sum[i]=score.sum[i]+score.a[i][j];
}
int temp;
char t[20];
for(i=0;i<score.n-1;i++)
for(j=0;j<score.n-1-i;j++)
{
if(score.sum[j]<score.sum[j+1]||(score.sum[j]==score.sum[j+1]&&score.a[j][5]<score.a[j+1][5]))
{
temp=score.sum[j];
score.sum[j]=score.sum[j+1];
score.sum[j+1]=temp;
temp=score.a[j][5];
score.a[j][5]=score.a[j+1][5];
score.a[j+1][5]=temp;
strcpy(t,score.name[j]);
strcpy(score.name[j],score.name[j+1]);
strcpy(score.name[j+1],t);
}
}
for(i=0;i<score.n;i++)
{
printf("%s %d %d",score.name[i],score.sum[i],score.a[i][5]);
printf("\n");
}
return 0;
}