#include <stdio.h>
#include <string.h>
#define MAX_NAME_LENGTH 20
#define MAX_TEST_COUNT 1000
struct Title {
char name[MAX_NAME_LENGTH];
int count;
};
int main() {
int t;
scanf("%d",&t);
while(t--)
{
int test_count;
scanf("%d", &test_count);
struct Title title[MAX_TEST_COUNT];
int i, j;
for (i = 0; i < test_count; i++) {
scanf("%s %d", title[i].name, &title[i].count);
}
for (i = 0; i < test_count - 1; i++) {
for (j = i + 1; j < test_count; j++) {
if (title[i].count < title[j].count) {
struct Title temp = title[i];
title[i] = title[j];
title[j] = temp;
}
}
}
for (i = 0; i < test_count; i++) {
printf("%s\n", title[i].name);
}
return 0;
}
}
为什自己运行出来我觉得没问题,在oj里面却是答案错误呢