#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
struct Student
{
string name;
string id;
int grade;
};
bool cmp(const Student &a, const Student &b)
{
if (a.grade != b.grade)
return a.grade > b.grade;
}
int main()
{
int n;
cin >> n;
vector<Student> student;
vector<Student> result;
for (int i = 0; i < n; i++)
{
Student stu;
cin >> stu.name >> stu.id >> stu.grade;
student.push_back(stu);
}
int grade1, grade2;
cin >> grade1 >> grade2;
for (auto it = student.begin(); it != student.end(); ++it)
{
if (it->grade >= grade1 && it->grade <= grade2)
result.push_back(*it);
}
sort(result.begin(), result.end(), cmp);
if (result.empty())
cout << "NONE" << endl;
else
{
for (auto it = result.begin(); it != result.end(); ++it)
{
cout << it->name << " " << it->id << endl;
}
}
}
PAT (Advanced) 1083. List Grades (25)
最新推荐文章于 2021-03-02 13:05:50 发布