AcWing 1569. 成绩单
原题链接
简单
作者:
Value
,
2020-05-26 11:25:22
,
所有人可见
,
阅读 448
#include <iostream>
#include <algorithm>
using namespace std;
struct node{
string name, id;
int score;
};
const int N = 110;
node stu[N];
int n;
void read(){
cin >> n;
for(int i = 0; i < n; i ++ ){
cin >> stu[i].name >> stu[i].id >> stu[i].score;
}
}
bool cmp(node a, node b){
return a.score > b.score;
}
int main(){
read();
sort(stu, stu + n, cmp);
int st, ed;
cin >> st >> ed;
bool flag = false; // 区间内是否有学生
for(int i = 0; i < n; i ++ ){
if(stu[i].score < st) break;
if(stu[i].score <= ed){
cout << stu[i].name << " " << stu[i].id << endl;
flag = true;
}
}
if(!flag) cout << "NONE" << endl;
return 0;
}