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

#include<stdio.h>
#include<stdlib.h>
#define ARRAY_SIZE 105
struct name {
	char ch[25];
	int times;
};
int comp(const void *p,const void *q){
	return ((struct name *)q)->times - ((struct name*)p)->times;
}
int main(){
	struct name nameARRAY[ARRAY_SIZE];
	int T,t,i;
	scanf("%d",&T);
	while(T--){
		scanf("%d",&t);
		for(i = 0;i < t;++i){
			scanf("%s %d",nameARRAY[i].ch,&nameARRAY[i].times);
		}
		qsort(nameARRAY,t,sizeof(struct name),comp);
		for(i = 0;i < t;++i){
			printf("%s\n",nameARRAY[i].ch);
		}
	}
}