题解 | #小白鼠排队#

小白鼠排队

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

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef struct mouse{
	int weight;
	char color[100];
}mouse;

bool com(mouse left,mouse right)
{
	if(left.weight>right.weight)
	return true;
	else
	return false;
}


int main()
{
	mouse m[1000];
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %s",&m[i].weight,m[i].color);
	}
	sort(m,m+n,com);
	for(int i=0;i<n;i++)
	{
		printf("%s\n",m[i].color);
	}
	
	
	
	
	
}

easy

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-09 12:11
点赞 评论 收藏
分享
求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
码农索隆:想看offer细节
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:23
转人工😡
门口唉提是地铁杀:五次握手了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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