题解 | 成绩排序
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[21];
int greed;
} Student;
int main() {
int i, j, n, op;
Student s[201];
scanf("%d",&n);
scanf("%d",&op);
memset(s, 0, sizeof(s));
for(i = 0; i < n; i++){
scanf("%s %d", s[i].name, &s[i].greed);
}
for(j = (op-1)*100; j <= 100*op; j++){
for(i = 0; i < n; i++){
if(abs(j) == s[i].greed){
printf("%s %d\n",s[i].name, s[i].greed);
}
}
}
return 0;
}
