………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………
共 8 条回复
》》》》》》》》》》》》》》。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
@root
举报
#include #include using namespace std; struct student { string name; int c; }; student s[21]; bool cmp(student a, student b) { if (a.c != b.c) return a.c > b.c; else return a.name < b.name; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i].name >> s[i].c; } sort(s, s + n, cmp); for (int i = 0; i < n; i++) { cout << s[i].name << " " << s[i].c << endl; } return 0; }
.....................
? ??
....................................................