#include <iostream>
#include<stdio.h>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
struct Stu{
char name[15];
char id[15];
int grade;
bool operator <(const Stu & b) const
{
return grade<b.grade;
}//从小到大排序
};
vector<struct Stu> stu;
int main()
{
int N,grade1,grade2;
Stu temp;
//freopen("/Users/pantingting/Documents/code/data/input", "r", stdin);
scanf("%d",&N);
for (int i=0; i<N; i++) {
scanf("%s%s%d",temp.name,temp.id,&temp.grade);
stu.push_back(temp);
}
scanf("%d%d",&grade1,&grade2);
sort(stu.begin(), stu.end());
int count=0;
for (int i=stu.size()-1; i>=0; i--) {
if (stu[i].grade<=grade2&&stu[i].grade>=grade1) {
printf("%s %s\n",stu[i].name,stu[i].id);
count++;
}
}
if (count==0) {
printf("NONE\n");
}
return 0;
}
PAT1083 List Grades
最新推荐文章于 2022-10-07 17:30:48 发布