| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 79783 | sh25_wangtaojie | 统计生日 | C++ | 解答错误 | 0 MS | 252 KB | 752 | 2026-01-04 14:43:03 |
#include <iostream> #include <vector> #include <algorithm> #include <string> struct Student { std::string name; int year, month, day; }; bool compare(const Student& a, const Student& b) { if (a.year != b.year) return a.year < b.year; if (a.month != b.month) return a.month < b.month; return a.day < b.day; } int main() { int n; std::cin >> n; std::vector<Student> students(n); for (int i = 0; i < n; ++i) { std::cin >> students[i].name >> students[i].year >> students[i].month >> students[i].day; } std::sort(students.begin(), students.end(), compare); for (int i = n - 1; i >= 0; --i) { std::cout << students[i].name << std::endl; } return 0; }