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: 18ms
Memory: 1092kB
In contest: 1139

#include<stdio.h>
struct grade
{
	char name[31];
	int theory,experience,total;
};

int main()
{
	int T,N,i,pass;
	struct grade student[101],temp;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d",&N);
		for(i=0;i<N;i++)
		{
			scanf("%s%d%d",student[i].name,&student[i].theory,&student[i].experience);
		    student[i].total=student[i].experience+student[i].theory;
		}
		for(pass=1;pass<N;pass++)
			for(i=0;i<N-pass;i++)
				if(student[i].total>student[i+1].total)
				{
					temp=student[i];
					student[i]=student[i+1];
					student[i+1]=temp;
				}
		for(i=N-1;i>=0;i--)
			puts(student[i].name);

	}
}