题解 | #小白鼠排队#
小白鼠排队
https://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b
#include <iostream>
#include <algorithm>
using namespace std;
struct mice{
int weight;
string color;
};
bool cmp(mice x,mice y)
{
return x.weight>y.weight;
}
int main() {
int n;
mice a[100];
while (cin >> n) {
for(int i=0;i<n;i++)
{
cin>>a[i].weight>>a[i].color;
}
sort(a,a+n,cmp);
for(int i=0;i<n;i++)
{
cout<<a[i].color<<endl;
}
}
}