题解 | #特殊排序#
小白鼠排队
http://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct mouse{
int weight;
string color;
};
bool comp(mouse x,mouse y){
return x.weight>y.weight;
}
int maxn=100;
int main(){
int arr[maxn];
int n;
while(scanf("%d",&n)!=EOF){
mouse arr[maxn];
for(int i=0;i<n;i++){
cin>>arr[i].weight>>arr[i].color;
}
sort(arr,arr+n,comp);
for(int i=0;i<n;i++){
cout<<arr[i].color<<endl;
}
}
return 0;
}