题目描述
知识点: 排序,STL
思路: 没啥好说的,就是排序输出
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5+10;
struct S{
string name,id;
int g;
bool operator < (const S s)const{
return g > s.g;
}
}s[N];
int main(){
int n,l,r;
cin>>n;
for(int i = 0;i < n;i++){
string name,id;
int g;
cin>>name>>id>>g;
s[i] = {name,id,g};
}
cin>>l>>r;
sort(s,s+n);
bool is_none = true;
for(int i = 0;i < n;i++){
if(s[i].g >= l && s[i].g <= r){
cout<<s[i].name<<" "<<s[i].id<<endl;
is_none = false;
}
}
if(is_none) cout<<"NONE";
return 0;
}