基本思想:
无;
关键点:
无;
#include<string> #include<iostream> #include<vector> #include<algorithm> using namespace std; struct mouse { int weight; string color; }; mouse num[120]; bool cmp(mouse a, mouse b) { return a.weight > b.weight; } int main() { int n; while (cin >> n) { for (int i = 0; i < n; i++) { cin >> num[i].weight >> num[i].color; } sort(num, num + n, cmp); for (int i = 0; i < n; i++) { cout << num[i].color << endl; } } }
来源:https://www.cnblogs.com/songlinxuan/p/12457891.html