-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path1083.cpp
More file actions
30 lines (28 loc) · 761 Bytes
/
1083.cpp
File metadata and controls
30 lines (28 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
struct Student {
char name[11];
char id[11];
int score;
};
int main() {
int n, lower, upper;
scanf("%d", &n);
vector<Student> students(n);
for (int i = 0; i < n; i++)
scanf("%s%s%d", students[i].name, students[i].id, &students[i].score);
scanf("%d%d", &lower, &upper);
sort(students.begin(), students.end(), [](Student a, Student b) {
return a.score > b.score;
});
bool found = false;
for (auto student : students) {
if (student.score < lower || student.score > upper) continue;
printf("%s %s\n", student.name, student.id);
found = true;
}
if (!found) printf("NONE\n");
return 0;
}