Start: Jan, 08, 2018 19:10:00
2017年秋季学期程序设计基础(C语言)期末考试
End: Jan, 08, 2018 21:40:00
Time elapsed:
Time remaining:

Problem_ID: E
Result: Accepted
Time: 17ms
Memory: 1092kB
In contest: 1139

#include<stdio.h>
struct people
{
	char name[31];
	int ll,sj,zf;
};
int main()
{
	struct people p[101],n;
	int a,b;
	scanf("%d",&a);
	for(int i=0;i<a;i++)
	{
		scanf("%d",&b);
		for(int j=0;j<b;j++){scanf("%s%d%d",p[j].name,&p[j].ll,&p[j].sj);p[j].zf=p[j].ll+p[j].sj;}
		for(int j=0;j<b-1;j++)
		{
			for(int m=j+1;m<b;m++)
			{
				if(p[j].zf<p[m].zf){n=p[j];p[j]=p[m];p[m]=n;}
			}
		}
		for(int j=0;j<b;j++)printf("%s\n",p[j].name);
	}
	return 0;
}