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

#include <stdio.h>
#define ARRAY 1000
#include <stdlib.h>
struct student{
	char name[25];
	int n;
};

int comp(const void *p,const void *q){
	return ((struct student *)q)->n-((struct student *)p) ->n;
}

int main()
{

	int t; 
	scanf("%d", &t);
	while(t--){	
		struct student student11[ARRAY];
		int n;
		scanf("%d", &n);
		int i, j;
		for(i=0; i<n; i++){
			scanf("%s %d", student11[i].name, &student11[i].n);
		}
		qsort(student11,n,sizeof(struct student),comp);
		for(i=0; i<n; i++){
			printf("%s\n", student11[i].name);
		}
	}
	
    return 0;
}