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: 4ms
Memory: 1120kB
Author: 2018212212151
In contest: 1284

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