题解 | #特殊排序#

小白鼠排队

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

//类似成绩排序,定义函数更简单一些
#include<iostream>
#include<algorithm>

using namespace std;

struct mouse 
{
    int weight;
    char color[10];
};
bool compare(mouse x,mouse y) 
{
    if(1) 
    {
        return x.weight>y.weight;
    }
}
int main() 
{
    mouse stu[100];
    int n;
    while(scanf("%d",&n)!=EOF) 
    {
        for(int i=0; i<n; i++) 
        {
            scanf("%d %s",&stu[i].weight,&stu[i].color);
        }
        sort(stu,stu+n,compare);
        for(int i=0; i<n; i++) 
        {
            printf("%s\n",stu[i].color);
        }
    }
    return 0;
}
全部评论

相关推荐

但听说转正率很低,我现在有在实习了,好纠结要不要去
熬夜脱发码农:转正率低归低,但是实习的经历你可以拿着,又不是说秋招不准备了
点赞 评论 收藏
分享
程序员小白条:你是沟通了900个,不是投了900份简历,你能投900份,意味着对面都要回复你900次,你早就找到实习了,没亮点就是这样的,别局限地区,时间投的也要早,现在都要7月了
点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
找工作时遇到的神仙HR
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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