7 条题解
- 
  0
#include <iostream> #include <algorithm> using namespace std; struct Student { int no; int chinese; int math; int english; int total; }; bool cmp(Student a, Student b) { if (a.total != b.total) { return a.total > b.total; } else if (a.chinese != b.chinese) { return a.chinese > b.chinese; } else if (a.math != b.math) { return a.math > b.math; } else if (a.english != b.english) { return a.english > b.english; } else { return a.no < b.no; } } int main() { int n, k; cin >> n >> k; Student students[n]; for (int i = 0; i < n; i++) { cin >> students[i].no >> students[i].chinese >> students[i].math >> students[i].english; students[i].total = students[i].chinese + students[i].math + students[i].english; } sort(students, students + n, cmp); cout << students[k - 1].no << " " << students[k - 1].chinese << " " << students[k - 1].math << " " << students[k - 1].english << " " << students[k - 1].total; return 0; } 
信息
- ID
 - 1363
 - 时间
 - 1000ms
 - 内存
 - 256MiB
 - 难度
 - 6
 - 标签
 - 递交数
 - 810
 - 已通过
 - 235
 - 上传者