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: 2018212212316
In contest: 1284

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