Start: Jul, 10, 2019 08:30:00
2019年度暑期短学期达标测试补考
End: Jul, 10, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 3ms
Memory: 1120kB
Author: 2018212212259
In contest: 1284

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct hao{
	char name[100];
	int count;
};
int comp(const void*p,const void*q)
{
	return ((struct hao*)q)->count-((struct hao*)p)->count;
}
int main()
{
	struct hao loy[100];
	int t,n,i;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(i=0;i<n;i++)
		{
			scanf("%s %d",loy[i].name,&loy[i].count);
		}
		qsort(loy,n,sizeof(struct hao),comp);
		for(i=0;i<n;++i)
		{
			printf("%s\n",loy[i].name);
		}
	}
	return 0;
}