#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Student {
string name;
int year;
int month;
int day;
};
bool compare(const Student& s1, const Student& s2) {
if (s1.year != s2.year)
return s1.year < s2.year;
if (s1.month != s2.month)
return s1.month < s2.month;
if (s1.day != s2.day)
return s1.day < s2.day;
return s1.name>s2.name;
}
int main() {
int n;
cin >> n;
vector<Student> students(n);
for (int i = 0; i < n; i++) {
cin >> students[i].name >> students[i].year >> students[i].month >> students[i].day;
}
sort(students.begin(), students.end(), compare);
for (const auto& student : students) {
cout << student.name << endl;
}
return 0;
}
生日(结构体排序)
最新推荐文章于 2024-07-02 14:10:13 发布