https://www.patest.cn/contests/pat-a-practise/1083
排序

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct E{
    char name[15];
    char id[15];
    int  grade;
    bool operator <(const E&b)const{
        return grade>b.grade;
    }
}stu[1005];

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %s %d",stu[i].name,stu[i].id,&stu[i].grade);
    }
    int grade1,grade2;
    scanf("%d%d",&grade1,&grade2);
    sort(stu,stu+n);
    int tag=0;
    for(int i=0;i<n;i++){
        if(stu[i].grade >= grade1 && stu[i].grade<=grade2){
            tag =1;
            printf("%s %s\n",stu[i].name,stu[i].id);
        }
    }
    if(tag==0) printf("NONE\n");
    return 0;
}