#include\u003Ciostream\u003E\n#include\u003Cvector\u003E\n#include\u003Calgorithm\u003E\n\nusing namespace std;\n\n// \u00E8FD0\u00E9FDC\u00E5B7A5\u00E7B584\u00E7ED8F\nstruct Student {\n string name;\n int year;\n int month;\n int day;\n};\n\n// \u00E6AF94\u00E8BC87\u00E587BD\u00EFBC8C\u00E4BAA4\u00E68E92\nbool compare(const Student& s1, const Student& s2) {\n if (s1.year != s2.year) {\n return s1.year \u003E s2.year;\n } else if (s1.month != s2.month) {\n return s1.month \u003E s2.month;\n } else {\n return s1.day \u003E s2.day;\n }\n}\n\nint main() {\n int n;\n cin \u003E\u003E n;\n \n vector\u003CStudent\u003E students(n);\n \n for (int i = 0; i \u003C n; i++) {\n cin \u003E\u003E students[i].name \u003E\u003E students[i].year \u003E\u003E students[i].month \u003E\u003E students[i].day;\n }\n \n sort(students.begin(), students.end(), compare);\n \n for (int i = 0; i \u003C n; i++) {\n cout \u003C\u003C students[i].name \u003C\u003C endl;\n }\n \n return 0;\n}


原文地址: https://www.cveoy.top/t/topic/pIRU 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录