| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 87031 | sh25_zhoumy | 期中考试成绩排序 | C++ | 通过 | 0 MS | 264 KB | 587 | 2026-04-10 15:16:48 |
#include <iostream> #include <algorithm> #include <string> using namespace std; struct Student { string name; int score; }; bool cmp(Student a, Student b) { if (a.score != b.score) { return a.score > b.score; } else { return a.name < b.name; } } int main() { int n; cin >> n; Student s[65]; for (int i = 0; i < n; i++) { cin >> s[i].name >> s[i].score; } sort(s, s + n, cmp); for (int i = 0; i < n; i++) { cout << s[i].name << " " << s[i].score << endl; } return 0; }