题解 | #小白鼠排队#

小白鼠排队

http://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
struct Mouse{
    int weight;
    string color;
};
bool Descend(Mouse a,Mouse b){
    return a.weight>b.weight;
}
int main(){
    int n;
    Mouse array[100];
    while(scanf("%d\n",&n)!=EOF){
        for(int i=0;i<n;++i){
            cin>>array[i].weight>>array[i].color;
        }
        sort(array,array+n,Descend);
        for(int i=0;i<n;++i){
            cout<<array[i].color<<endl;
        }
    }
    return 0;
}

全部评论

相关推荐

06-11 17:39
门头沟学院 Java
小呆呆的大鼻涕:卧槽,用户彻底怒了
点赞 评论 收藏
分享
不对是145个人…嗯…&nbsp;大家都没发现秋招提前批来了嘛..笑死我了
牛客39712426...:投了也是浪费时间,之前投米实习,除了浪费我时间写笔试题没有任何反馈,懒得投了
26届校招投递进展
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务